Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing an uninitialized value inside a sub in rakudo makes parrot segfault #201

Closed
p6rt opened this issue Jul 30, 2008 · 4 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Jul 30, 2008

Migrated from rt.perl.org#57396 (status was 'resolved')

Searchable as RT57396$

@p6rt
Copy link
Author

p6rt commented Jul 30, 2008

From @masak

$ ./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 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

@p6rt
Copy link
Author

p6rt commented Feb 25, 2009

From @jnthn

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

@p6rt
Copy link
Author

p6rt commented Feb 25, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed Feb 25, 2009
@p6rt
Copy link
Author

p6rt commented Feb 25, 2009

@jnthn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant