Subject: | Segfaults when using state variable |
This code:
use Sub::Clone
my $a = sub {state $b = 0; $b++};
clone_sub $a;
causes Perl v5.16.3 to segfault. The back trace is:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000045d7c0 in Perl_cv_clone ()
#1 0x00007f73a6190e06 in clone_sub ()
from /home/greg/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.3/x86_64-linux/auto/Sub/Clone/Clone.so
#2 0x00007f73a619103d in XS_Sub__Clone_clone_sub ()
from /home/greg/perl5/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.3/x86_64-linux/auto/Sub/Clone/Clone.so
#3 0x0000000000499d4c in Perl_pp_entersub ()
#4 0x0000000000492a63 in Perl_runops_standard ()
#5 0x0000000000434fae in Perl_call_sv ()
#6 0x000000000043557a in Perl_call_list ()
#7 0x000000000041fc36 in S_process_special_blocks ()
#8 0x0000000000430905 in Perl_newATTRSUB_flags ()
#9 0x0000000000431479 in Perl_utilize ()
#10 0x000000000045a870 in Perl_yyparse ()
#11 0x0000000000439132 in perl_parse ()
#12 0x000000000041f3f0 in main ()