[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
[perl #22977] Bug in format/write
On Mon Jul 14 15:15:03 2003, davem wrote:
> On Mon, Jul 14, 2003 at 05:37:42AM -0000, Ruediger Schopper wrote:
> > I belive, that we've found a bug in perl. We discovered it when
> changing from
> > perl-5.4.4 to perl-5.8.0, where we got strange results with
> > write in a program we heavily used without problems.
>
> The bug can be reduced to the simpler case:
>
> sub f ($); # Comment out to get right result!
> sub f ($) {
> my $test = $_[0];
> write;
> format STDOUT =
> @<<<<<<<
> $test
> .
> }
> f(1);
> f(2);
>
> It's due to there being multiple CVs associated with f due to to the
> forward declaration, and to newATTRSUB() copying the contents of the
> second CV to the first. This causes any nested subs to have
CvOUTSIDE
> pointing to the wrong CV. A call to pad_fixup_inner_anons() fixes up
> any
> nested anon subs, but nested formats aren't fixed up.
>
> Since I'm currently working on trying to get sub declarations
> to take effect at the start of a sub rather than at the end (eg
> sub f($) { f(1) }), I'll see if I can work in a fix for this at the
> same time.
>
It appears that things got worse for 5.10.0/blead...
perl-5.8.8 rt-22977.pl
1
1
(Instead of 1 2)
perl-5.9.0 rt-22977.pl
Segmentation fault
perl-5.10.0 rt-22977.pl
Segmentation fault
perl-blead rt-22977.pl
Segmentation fault
- Follow-Ups from:
-
andreas.koenig.7os6VVqR@franz.ak.mind.de (Andreas J. Koenig)
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]