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

Owner: Nobody
Requestors: shoichikaji [at] gmail.com
Cc:
AdminCc:

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



Subject: [BUG] segmentation fault with precompile + add_method
To: rakudobug [...] perl.org
Date: Wed, 14 Oct 2015 01:20:37 +0900
From: Shoichi Kaji <shoichikaji [...] gmail.com>
Download (untitled) / with headers
text/plain 765b
The following script exits with segmentation fault. (code is also available at https://gist.github.com/shoichikaji/42f03675cec2d6b4a489) ``` #!/bin/bash set -xu rm -rf lib mkdir lib cat >lib/A.pm6 <<'EOF'; class B {} class A { sub foo($b, *@) {} BEGIN { B.^add_method: 'bar', method () { foo(self) }; } } EOF perl6-m --target=mbc --output=lib/A.pm6.moarvm lib/A.pm6 perl6-m -Ilib -MA -e 'B.bar' ``` ``` $ bash test.sh + rm -rf lib + mkdir lib + cat + perl6-m --target=mbc --output=lib/A.pm6.moarvm lib/A.pm6 + perl6-m -Ilib -MA -e B.bar test.sh: line 19: 31493 Segmentation fault perl6-m -Ilib -MA -e 'B.bar' ``` My perl version is: $ perl6-m -v This is perl6 version 2015.09-360-g154f44b built on MoarVM version 2015.09-79-gee9fc2b
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 268b
It seems to segfault in the op getlex when trying to locate &foo. Moving sub foo to within the BEGIN block helps and moving it outside of A gives: Cannot invoke this object in method <anon> at lib/A.pm6:5 Neither the rakudo optimizer nor spesh seem to be to blame.
To clarify: f in getlex after the while loop is null.
To: perl6-compiler [...] perl.org
From: Nicholas Clark <nick [...] flirble.org>
Date: Wed, 14 Oct 2015 10:14:29 +0100
Subject: Re: [perl #126350] [BUG] segmentation fault with precompile + add_method
Download (untitled) / with headers
text/plain 946b
On Tue, Oct 13, 2015 at 09:20:54AM -0700, Shoichi Kaji wrote: Show quoted text
> + perl6-m -Ilib -MA -e B.bar > test.sh: line 19: 31493 Segmentation fault perl6-m -Ilib -MA -e 'B.bar' > ```
$ ./perl6-m -Ilib -MA -e 'B.bar' ASAN:SIGSEGV ================================================================= ==27416==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7f78d5719316 sp 0x7fffff5a7640 bp 0x7fffff5a8ff0 T0) #0 0x7f78d5719315 in MVM_interp_run src/core/interp.c:196 #1 0x7f78d59e757e in MVM_vm_run_file src/moar.c:243 #2 0x401a4f in main src/main.c:191 #3 0x7f78d4f7ad5c in __libc_start_main (/lib64/libc.so.6+0x1ed5c) #4 0x401058 (/home/nicholas/Sandpit/moar-san/bin/moar+0x401058) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV src/core/interp.c:196 MVM_interp_run ==27416==ABORTING So there's nothing wrong happening before a NULL pointer dereference. Nicholas Clark


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