Perl linked list segfault

Dagfinn Ilmari Mannsåker ilmari at
Wed Nov 4 10:46:14 GMT 2009

Dirk Koopman <djk at> writes:

> Andy Wardley wrote:
>> On 04/11/2009 07:55, Andy Wardley wrote:
>>> I've got some code that's making Perl segfault.
>> Here's the complete script in case anyone wants to play along at
>> home:
> shifting out all the @tokens works; undefing or emptying @tokens segfaults.
> Is this an ordering thing?

It seems to be recursing when freeing @tokens, I'm see the following stacktrace:

[fuckloads of reapeating calls snipped]
#192663 0x0000000000492bcc in Perl_sv_clear (my_perl=0x78a010, sv=0x7b5a80) at sv.c:5236
#192664 0x00000000004931a1 in Perl_sv_free2 (my_perl=0x78a010, sv=0x7b5a80) at sv.c:5368
#192665 0x00000000004719e8 in Perl_av_undef (my_perl=0x78a010, av=0x78ee88) at av.c:485
#192666 0x0000000000492c38 in Perl_sv_clear (my_perl=0x78a010, sv=0x78ee88) at sv.c:5193
#192667 0x00000000004931a1 in Perl_sv_free2 (my_perl=0x78a010, sv=0x78ee88) at sv.c:5368
#192668 0x0000000000492bcc in Perl_sv_clear (my_perl=0x78a010, sv=0x78ecd8) at sv.c:5236
#192669 0x00000000004931a1 in Perl_sv_free2 (my_perl=0x78a010, sv=0x78ecd8) at sv.c:5368
#192670 0x00000000004700e8 in Perl_av_clear (my_perl=0x78a010, av=0x7d65b8) at av.c:453
#192671 0x00000000004b5ca6 in Perl_leave_scope (my_perl=0x78a010, base=5) at scope.c:799
#192672 0x000000000047e199 in Perl_pp_leavesub (my_perl=0x78a010) at pp_hot.c:2475
#192673 0x0000000000454ce4 in Perl_runops_debug (my_perl=0x78a010) at dump.c:1931
#192674 0x0000000000478aa4 in S_run_body (my_perl=<value optimised out>) at perl.c:2391
#192675 perl_run (my_perl=<value optimised out>) at perl.c:2309
#192676 0x000000000042177c in main (argc=2, argv=0x7fffffffe198, env=0x7fffffffe1b0) at perlmain.c:113

I think it's time to take this to p5p.

"A disappointingly low fraction of the human race is,
 at any given time, on fire." - Stig Sandbeck Mathisen

More information about the mailing list