develooper Front page | perl.perl5.porters | Postings from October 2014

Re: 5.20.1 / state bug

Thread Previous | Thread Next
From:
ilmari
Date:
October 21, 2014 16:21
Subject:
Re: 5.20.1 / state bug
Message ID:
d8jy4s9qtq7.fsf@dalvik.ping.uio.no
Niels Larsen <niels@genomics.dk> writes:

> Perl developers,
>
> The script below shows what I believe is an error in 5.20.1 and 
> possibly other version, haven't tried - a state scalar becomes 
> undefined when copied from. Output from perl -V is also below. 
> Note copy-on-write is off, when on the state value keeps its 
> value. 

This is fixed in blead. Bisecting a simplified case:

./Porting/bisect.pl -Accflags=-DPERL_NO_COW --target=miniperl --start=v5.20.0 --expect-fail -e 'use strict; use feature "state"; sub state_test { state $s; $s = "foo"; my $c = $s; die "gone" unless defined $s } state_test()'

shows that this commit fixed it:

commit c0683843e9299db25f354e2c8c90faa7614950d1
Author: Father Chrysostomos <sprout@cpan.org>
Date:   Mon Sep 22 20:25:29 2014 -0700

    Stop setting PADMY; renumber PADSTALE
    
    The PADMY flag was originally used on values stored in pads as a way
    to mark those slots ase being in use already during pad allocation.
    That changed for the most part all the way back in bbce6d6978
    (perl5.003_09), but vestiges still remained, because some ops used
    PADMY for their targets.  I removed the last one yesterday in
    14d91147.  So the PADMY flag now serves no purpose.
    
    At run time, the sole purpose of PADMY is to determine the meaning of
    the flag bit shared by PADTMP and PADSTALE.  If PADMY is set, the flag
    means the latter.  Instead of that more complicated check, we can just
    renumber PADSTALE to use the PADMY bit and assume that anything not
    PADTMP is PADMY.
    
    This commit changes the flags and does just enough to get
    tests passing (except Peek.t).
    
    fixup for padmy flag renumbering



-- 
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
 the consequences of."                              -- Skud's Meta-Law


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