On Thu, Oct 29, 2015 at 07:41:06PM +0000, Nicholas Clark wrote:
> On Thu, Oct 29, 2015 at 09:22:30AM -0700, Pepe Schwarz wrote:
>
> > The same code on R-M segfaults:
> >
> > 16:15 <psch> m: A: for 1 { for 1 { last A }; CONTROL { when CX::Last { say
> > "last" }; default { .perl.say } } }
> > 16:15 <camelia> rakudo-moar 3cc195: OUTPUT«(signal SEGV)»
>
> $ ./perl6-m -Ilib -e 'A: for 1 { for 1 { last A }; CONTROL { when CX::Last {
> say "last" }; default { .perl.say } } }'
> ASAN:SIGSEGV
> =================================================================
> ==28758==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000024 (pc
> 0x7f88780c7391 sp 0x7fff1a233990 bp 0x7fff1a2339a0 T0)
> #0 0x7f88780c7390 in MVM_string_graphs src/strings/ops.h:30
> #1 0x7f88780e7dcd in MVM_interp_run src/core/interp.c:1491
> #2 0x7f8878398003 in MVM_vm_run_file src/moar.c:249
> #3 0x401a4f in main src/main.c:191
> #4 0x7f887792ad5c in __libc_start_main (/lib64/libc.so.6+0x1ed5c)
> #5 0x401058 (/home/nicholas/Sandpit/moar-san/bin/moar+0x401058)
>
> AddressSanitizer can not provide additional info.
> SUMMARY: AddressSanitizer: SEGV src/strings/ops.h:30 MVM_string_graphs
> ==28758==ABORTING
>
>
> Looks like it's "just" a NULL pointer dereference.
valgrind concurs:
$ valgrind /home/nicholas/Sandpit/moar-g/bin/moar
--libpath="/home/nicholas/Sandpit/moar-g/share/nqp/lib" --libpath="."
/home/nicholas/Perl/rakudo/perl6.moarvm -Ilib -e 'A: for 1 { for 1 { last A };
CONTROL { when CX::Last { say "last" }; default { .perl.say } } }'
==25743== Memcheck, a memory error detector
==25743== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==25743== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==25743== Command: /home/nicholas/Sandpit/moar-g/bin/moar
--libpath=/home/nicholas/Sandpit/moar-g/share/nqp/lib --libpath=.
/home/nicholas/Perl/rakudo/perl6.moarvm -Ilib -e A:\ for\ 1\ {\ for\ 1\ {\
last\ A\ };\ CONTROL\ {\ when\ CX::Last\ {\ say\ "last"\ };\ default\ {\
.perl.say\ }\ }\ }
==25743==
==25743== Invalid read of size 4
==25743== at 0x4F7E95A: MVM_string_graphs (ops.h:30)
==25743== by 0x4F88DDB: MVM_interp_run (interp.c:1491)
==25743== by 0x5080950: MVM_vm_run_file (moar.c:249)
==25743== by 0x401280: main (main.c:191)
==25743== Address 0x24 is not stack'd, malloc'd or (recently) free'd
==25743==
==25743==
==25743== Process terminating with default action of signal 11 (SIGSEGV)
==25743== Access not within mapped region at address 0x24
==25743== at 0x4F7E95A: MVM_string_graphs (ops.h:30)
==25743== by 0x4F88DDB: MVM_interp_run (interp.c:1491)
==25743== by 0x5080950: MVM_vm_run_file (moar.c:249)
==25743== by 0x401280: main (main.c:191)
==25743== If you believe this happened as a result of a stack
==25743== overflow in your program's main thread (unlikely but
==25743== possible), you can try to increase the size of the
==25743== main thread stack using the --main-stacksize= flag.
==25743== The main thread stack size used in this run was 10485760.
==25743==
==25743== HEAP SUMMARY:
==25743== in use at exit: 53,962,132 bytes in 213,579 blocks
==25743== total heap usage: 233,496 allocs, 19,917 frees, 69,014,035 bytes
allocated
==25743==
==25743== LEAK SUMMARY:
==25743== definitely lost: 36,954 bytes in 673 blocks
==25743== indirectly lost: 21,240 bytes in 681 blocks
==25743== possibly lost: 175,280 bytes in 3,133 blocks
==25743== still reachable: 53,728,658 bytes in 209,092 blocks
==25743== suppressed: 0 bytes in 0 blocks
==25743== Rerun with --leak-check=full to see details of leaked memory
==25743==
==25743== For counts of detected and suppressed errors, rerun with: -v
==25743== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 9 from 9)
Segmentation fault
Nicholas Clark