Skip Menu |
Report information
Id: 106932
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: sorear <stefanor [at] cox.net>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Junctions in subsignatures can cause infinite recursion
Date: Fri, 23 Dec 2011 21:12:23 -0800
To: rakudobug [...] perl.org
From: Stefan O'Rear <stefanor [...] cox.net>
Download (untitled) / with headers
text/plain 248b
21:09 < sorear> rakudo: sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ]) 21:09 <+p6eval> rakudo eb6c4b: OUTPUT«(timeout)maximum recursion depth exceeded␤» There's no direct junction, so AUTOTHREAD makes no progress when called.
RT-Send-CC: perl6-compiler [...] perl.org
Verified behavior, unchanged in e8cea1. -- Will "Coke" Coleda
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 482b
On Fri Dec 23 21:12:40 2011, sorear wrote: Show quoted text
> 21:09 < sorear> rakudo: sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ]) > 21:09 <+p6eval> rakudo eb6c4b: OUTPUT«(timeout)maximum recursion depth > exceeded␤» > > There's no direct junction, so AUTOTHREAD makes no progress when called.
Exciting new failure mode: ./perl6 -e 'sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ])' cannot stringify this in sub foo at -e:1 in block <unit> at -e:1 -- Will "Coke" Coleda
On Thu Jul 09 16:48:03 2015, coke wrote: Show quoted text
> On Fri Dec 23 21:12:40 2011, sorear wrote:
> > 21:09 < sorear> rakudo: sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ]) > > 21:09 <+p6eval> rakudo eb6c4b: OUTPUT«(timeout)maximum recursion depth > > exceeded␤» > > > > There's no direct junction, so AUTOTHREAD makes no progress when called.
> > Exciting new failure mode: > > ./perl6 -e 'sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ])' > cannot stringify this > in sub foo at -e:1 > in block <unit> at -e:1
The error is coming from the signature binder: # Recurse into signature binder. my $result := bind(make_vm_capture($capture), $subsig, $lexpad, $no_nom_type_check, $error); unless $result == $BIND_RESULT_OK { if $error { # Note in the error message that we're in a sub-signature. $error[0] := $error[0] ~ " in sub-signature"; $error[0] is of type BOOTCode here, and cannot be stringified.
On Fri Mar 25 13:28:16 2016, moritz wrote: Show quoted text
> On Thu Jul 09 16:48:03 2015, coke wrote:
> > On Fri Dec 23 21:12:40 2011, sorear wrote:
> > > 21:09 < sorear> rakudo: sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) > > > ]) > > > 21:09 <+p6eval> rakudo eb6c4b: OUTPUT«(timeout)maximum recursion > > > depth > > > exceeded␤» > > > > > > There's no direct junction, so AUTOTHREAD makes no progress when > > > called.
> > > > Exciting new failure mode: > > > > ./perl6 -e 'sub foo(Mu $x [ $y ]) { }; foo([ any(1,2,3) ])' > > cannot stringify this > > in sub foo at -e:1 > > in block <unit> at -e:1
> > The error is coming from the signature binder: > > # Recurse into signature binder. > my $result := bind(make_vm_capture($capture), $subsig, $lexpad, > $no_nom_type_check, $error); > unless $result == $BIND_RESULT_OK { > if $error { > # Note in the error message that we're in a sub-signature. > $error[0] := $error[0] ~ " in sub-signature"; > > $error[0] is of type BOOTCode here, and cannot be stringified.
I've tried this patch: diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp index cb0cc76..c76ed8a 100644 --- a/src/Perl6/Metamodel/BOOTSTRAP.nqp +++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp @@ -569,8 +569,11 @@ my class Binder { my $result := bind(make_vm_capture($capture), $subsig, $lexpad, $no_nom_type_check, $error); unless $result == $BIND_RESULT_OK { - if $error { + # $error[0] can be a callable when it's throwing a HLL exception. + # In this case we can't augment it with extra information. + if $error && !nqp::isinvokable($error[0]) { # Note in the error message that we're in a sub-signature. + say($error[0].HOW.name($error[0])); $error[0] := $error[0] ~ " in sub-signature"; if $has_varname { $error[0] := $error[0] ~ " of parameter " ~ $varname; But with that, the bind failure produces an infinite loop rather than reporting an error.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org