develooper Front page | perl.perl5.porters | Postings from September 2017

[perl #119977] hash elem ref in @_ disappears

From:
James E Keenan via RT
Date:
September 30, 2017 03:33
Subject:
[perl #119977] hash elem ref in @_ disappears
Message ID:
rt-4.0.24-18591-1506742428-1830.119977-15-0@perl.org
On Tue, 24 Sep 2013 13:07:50 GMT, zefram@fysh.org wrote:
> 
> This is a bug report for perl from zefram@fysh.org,
> generated with the help of perlbug 1.39 running under perl 5.19.4.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> $ cat t0
> my $iter;
> my %llll;
> sub bbbb { }
> sub aaaa {
>         \@_ if $iter & 1;
>         bbbb($_[1]) if $iter & 2;
>         delete $llll{p};
>         print $_[0] // "undef", "\n";
> }
> for(0..3) {
>         $iter = $_;
>         %llll = (p => "oooo");
>         aaaa($llll{p}, undef);
> }
> $ perl5.18.1 t0
> undef
> oooo
> oooo
> oooo
> $ perl5.19.4 t0
> undef
> oooo
> undef
> oooo
> 
> It's surprising that $_[0] ever fails to retain the defined value.
> Even if the deleted element becoming undef is somehow correct, the
> two expressions controlled by $iter look as if they shouldn't make any
> difference to the behaviour.  Class-MethodMaker on CPAN is (in a very
> roundabout way) depending on the old behaviour of the case that
> changed
> in 5.19.4, and so is now failing its tests.
> 

Class-MethodMaker appears to have recovered.  Almost all PASS at http://matrix.cpantesters.org/?dist=Class-MethodMaker


> Devel::Peek says that the undefs that appear with 5.19.4 are actually
> &PL_sv_undef, whereas the undef that appeared previously was a
> refcnt=1
> writable scalar.  So the recent change looks to be related to the
> undef-in-array change.
> 
> Suspect that the lack of refcounting on the stack is involved.
> 


On Tue, 24 Sep 2013 21:41:45 GMT, zefram@fysh.org wrote:
> Bisect for the change between 5.19.3 and 5.19.4 says
> 
> ce0d59fdd1c7d145efdf6bf8da56a259fed483e4 is the first bad commit
> commit ce0d59fdd1c7d145efdf6bf8da56a259fed483e4
> Author: Father Chrysostomos <sprout@cpan.org>
> Date:   Tue Jul 2 13:07:45 2013 -0700
> 
>     [perl #7508] Use NULL for nonexistent array elems
> 
> -zefram
> 

I can confirm that that is the commit where the behavior of the test program changed.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=119977



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