[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [perl #54114] semi-panic: attempt to dup freed string
On Tue, May 13, 2008 at 08:09:29PM +0100, Nicholas Clark wrote:
> On Tue, May 13, 2008 at 07:58:57AM -0700, Ed Avis wrote:
>
> > This test program:
> >
> > $r = f();
> > my @a = @$r;
> > sub f {
> > push @a, undef;
> > return \@a;
> > }
> >
> > produces the error message
> >
> > semi-panic: attempt to dup freed string at test line 2.
> >
> > I am using perl built with some patches from Fedora and I couldn't
> > reproduce this with perl-5.10.0 on Cygwin; please let me know if you
> > can reproduce it.
>
> I can reproduce it on OS X and Debian. (on blead)
>
> I suspect it's a side effect of Perl's stack not being reference counted.
[following up on a 6 month old thread ]
It's the 'detect common values on each side of list assignment' detector
is being tricked.
ie if you did
@a = (1,$a[0],2);
it would make copies of all elements on the RHS before emptying @a.
In this case it doesn't realise and doesn't make the copies, so the
elements of @a get freed prematurely.
I'm guessing it's because the LHS is a 'my', the optimiser falsely
assumes that @a can't affect anythinng on its RHS and so doesn't set the
OPpASSIGN_COMMON flag on aassign.
--
All wight. I will give you one more chance. This time, I want to hear
no Wubens. No Weginalds. No Wudolf the wed-nosed weindeers.
-- Life of Brian
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]