develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH] Perl_croak("Use of freed value in iteration")

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
April 21, 2003 05:30
Subject:
Re: [PATCH] Perl_croak("Use of freed value in iteration")
Message ID:
20030421143459.1c04b98f.rgarciasuarez@free.fr
Dave Mitchell wrote:
> It's a well-known bug that deleting things while iterating over items
> on the stack causes nasty coredumps, eg
> 
>     @a = (3,4);
>     @a = () for (1,2,@a);
> 
> This is because items on the stack aren't ref counted. This is too hard
> to fix, but the following patch applies the princple of post-equine-exit-
> paddock-area-securing, by giving a fatal error if it iterates over a freed
> value. Better a strange warning than a coredump?
> 
> PS - I wasn't sure where to put a test - cmd/for.t sounds likely, but
> it needs a fresh Perl, so would it be be okay to add "require test.pl" in
> such a base test file?

Why do you need a fresh perl ?
eval {} should be sufficient (once the bug is fixed ;-)

> +=item Use of freed value in iteration (perhaps you modified the iterated array within the loop?)
> +
> +(F) This is typically caused by code like the following:
-- 
Unmarked is not *NIX

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About