On Tue Jul 29 21:40:30 2008, masak wrote:
> $ ./perl6 -e 'my $x; $x.foo()'
> 
> works, but
> 
> $ ./perl6 -e 'sub a { my $x; $x.foo() }; a()'
> Method 'foo' not found for invocant of class 'Undef'
> current instr.: 'a' pc 82 (EVAL_13:42)
> called from Sub '_block11' pc 17 (EVAL_13:11)
> called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
> (src/PCT/HLLCompiler.pir:481)
> called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305
> (src/PCT/HLLCompiler.pir:708)
> called from Sub 'parrot;Perl6::Compiler;main' pc 14623 (perl6.pir:172)
> perl6(33740) malloc: *** error for object 0x2994f90: double free
> *** set a breakpoint in malloc_error_break to debug
> Segmentation fault
> 
> doesn't.
> 
The double frees by and large should now be resolved (am closing other
tickets related to that issue, but won't Cc every one to the list), and
the error here is fine IMO (if a little over-backtraced, but there's
another ticket about that which is more general).

> The method call "$x.foo()" can be replaced with other things that
> attempt to read $x -- such as "$x++" or "$x[0]" -- with similar
> results.
> 
> Actually, this segfaults too, even though execution never enters the sub:
> 
> $ ./perl6 -e 'sub a { my $x; $x.foo() }; A()'
> invoke() not implemented in class 'Undef'
> current instr.: '_block11' pc 23 (EVAL_13:15)
> called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
> (src/PCT/HLLCompiler.pir:481)
> called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305
> (src/PCT/HLLCompiler.pir:708)
> called from Sub 'parrot;Perl6::Compiler;main' pc 14902 (perl6.pir:172)
> perl6(37079) malloc: *** error for object 0x298f720: double free
> *** set a breakpoint in malloc_error_break to debug
> Segmentation fault

This now doesn't segfault, and also gives a better error saying you
tried to call a non-existent sub.

Thanks,

Jonathan

Reply via email to