Re: [perl #9012] Segfault with -DXst

2005-07-17 Thread Dave Mitchell
On Wed, Jul 13, 2005 at 07:31:36AM -0700, Steve Peters via RT wrote:
> > This program displays a severe memory leak:
> > 
> > $x = "0123456789";
> > for (1..10) {
> >   my @s;
> >   $x =~ /.*(.+?)(?{push @s, $1})(?!)/;
> > }
> > 
> > END { print STDERR "Global destruction\n" }
> > 
> > (Probably related to the bug report I just filed.)
> > 
> > While investigating it, I ran:
> > 
> > /src/bleadperl-build/perl -DXst /tmp/mem.pl
> > 
> > Perl died from a segmentation fault partway through the run.  However,
[snip]
> This core dump is still around in [EMAIL PROTECTED]  Below is the backtrace.

yep, this comes under the category of "re_eval isn't safe accessing outer
lexical vars". Yes another problem that will vanish when I finish my my
mythical rewrite of the re_eval code.

-- 
The optimist believes that he lives in the best of all possible worlds.
As does the pessimist.


[perl #9012] Segfault with -DXst

2005-07-13 Thread Steve Peters via RT
> [EMAIL PROTECTED] - Wed Apr 24 06:40:12 2002]:
> 
> This is a bug report for perl from [EMAIL PROTECTED],
> generated with the help of perlbug 1.33 running under perl v5.6.1.
> 
> 
> -
> [Please enter your report here]
> 
> This program displays a severe memory leak:
> 
> $x = "0123456789";
> for (1..10) {
>   my @s;
>   $x =~ /.*(.+?)(?{push @s, $1})(?!)/;
> }
> 
> END { print STDERR "Global destruction\n" }
> 
> (Probably related to the bug report I just filed.)
> 
> While investigating it, I ran:
> 
> /src/bleadperl-build/perl -DXst /tmp/mem.pl
> 
> Perl died from a segmentation fault partway through the run.  However,
> 
> /src/bleadperl-build/perl -DX /tmp/mem.pl
> 
> runs and completes normally.
> 
> 
> I have attached the run output below.
> 
> plover% /src/bleadperl-build/perl -DXst /tmp/mem.pl
> Pad 0x816dcb0 alloc 1 for range
> Pad 0x816dcb0 sv 1
> Pad 0x816dcb0 alloc 2 for range
> Pad 0x816dcb0 sv 2
> Pad 0x816dcb0 alloc 3 for padsv
> Pad 0x8175040 alloc 1 for padsv
> Pad 0x8175040 alloc 2 for push
> Pad 0x816dcb0 free 1
> Pad 0x816dcb0 free 2
> Pad 0x8175240 alloc 1 for stringify
> =>
> (/tmp/mem.pl:8)   null
> =>
> (/tmp/mem.pl:8)   const(PV("Global destruction\12"\0))
> =>  PV("Global destruction\12"\0)
> (/tmp/mem.pl:8)   stringify
> Pad 0x8175240 sv 1
> Pad 0x8175240 sv 1
> Pad 0x8175240 swipe 1
> Pad 0x8175240 free 1
> 
> EXECUTING...
> 
> =>
> (/tmp/mem.pl:0)   enter
> =>
> (/tmp/mem.pl:0)   nextstate
> =>
> (/tmp/mem.pl:2)   const(PV("0123456789"\0))
> =>  PV("0123456789"\0)
> (/tmp/mem.pl:2)   gvsv(main::x)
> =>  PV("0123456789"\0)  UNDEF
> (/tmp/mem.pl:2)   sassign
> =>  PV("0123456789"\0)
> (/tmp/mem.pl:2)   nextstate
> =>
> (/tmp/mem.pl:3)   pushmark
> =>  *
> (/tmp/mem.pl:3)   const(IV(1))
> =>  *  IV(1)
> (/tmp/mem.pl:3)   const(IV(10))
> =>  *  IV(1)  IV(10)
> (/tmp/mem.pl:3)   gv(main::_)
> =>  *  IV(1)  IV(10)  GV()
> (/tmp/mem.pl:3)   enteriter
> =>
> (/tmp/mem.pl:3)   iter
> =>  SV_YES
> (/tmp/mem.pl:3)   and
> =>
> (/tmp/mem.pl:3)   nextstate
> =>  SV_YES  PVNV(10)
> (/tmp/mem.pl:4)   padav(@s)
> Pad 0x816dcb0 sv 3
> =>  SV_YES  PVNV(10)  IV(0)
> (/tmp/mem.pl:4)   nextstate
> =>  SV_YES  PVNV(10)
> (/tmp/mem.pl:5)   gvsv(main::x)
> =>  SV_YES  PVNV(10)  PV("0123456789"\0)
> (/tmp/mem.pl:5)   match
> =>  SV_YES  PVNV(10)
> (/tmp/mem.pl:5)   nextstate
> =>  SV_YES  PVNV(10)
> ((re_eval 1):1)   pushmark
> =>  SV_YES  PVNV(10)  *
> ((re_eval 1):1)   padavSegmentation fault (core dumped)
> plover%
> 

This core dump is still around in [EMAIL PROTECTED]  Below is the backtrace.

#0  0x0810dee7 in Perl_debop (my_perl=0x82d5008, o=0x830ab38) at dump.c:1639
1639sv = *av_fetch(comppad, o->op_targ, FALSE);
(gdb) bt
#0  0x0810dee7 in Perl_debop (my_perl=0x82d5008, o=0x830ab38) at dump.c:1639
#1  0x0810d788 in Perl_runops_debug (my_perl=0x82d5008) at dump.c:1597
#2  0x081ff73d in S_regmatch (my_perl=0x82d5008, prog=0x82f5390)
at regexec.c:3219
#3  0x08205c50 in S_regmatch (my_perl=0x82d5008, prog=0x82f537c)
at regexec.c:4078
#4  0x0820684c in S_regmatch (my_perl=0x82d5008, prog=0x82f5374)
at regexec.c:4145
#5  0x081f8dde in S_regtry (my_perl=0x82d5008, prog=0x82f5330,
startpos=0x82ecd08 "0123456789") at regexec.c:2225
#6  0x081f61a4 in Perl_regexec_flags (my_perl=0x82d5008, prog=0x82f5330,
stringarg=0x82ecd08 "0123456789", strend=0x82ecd12 "",
strbeg=0x82ecd08 "0123456789", minend=0, sv=0x82f2488, data=0x0,
flags=3)
at regexec.c:1765
#7  0x0813d317 in Perl_pp_match (my_perl=0x82d5008) at pp_hot.c:1280
#8  0x0810d7ed in Perl_runops_debug (my_perl=0x82d5008) at dump.c:1600
#9  0x0806aaf6 in S_run_body (my_perl=0x82d5008, oldscope=1) at perl.c:1918
#10 0x0806a1c0 in perl_run (my_perl=0x82d5008) at perl.c:1847
#11 0x0806074b in main (argc=3, argv=0xbfe47764, env=0xbfe47774)
at perlmain.c:103