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

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

Thread Next
From:
Zefram
Date:
September 24, 2013 13:08
Subject:
[perl #119977] hash elem ref in @_ disappears
Message ID:
rt-3.6.HEAD-1873-1380028071-1355.119977-75-0@perl.org
# New Ticket Created by  Zefram 
# Please include the string:  [perl #119977]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119977 >



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.

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.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.19.4:

Configured by root at Mon Sep 23 11:12:36 UTC 2013.

Summary of my perl5 (revision 5 version 19 subversion 4) configuration:
   
  Platform:
    osname=linux, osvers=2.6.32-5-686, archname=i686-linux-64int-ld
    uname='linux beryllium.photobox.priv 2.6.32-5-686 #1 smp mon feb 25 01:04:36 utc 2013 i686 gnulinux '
    config_args='-des -Dusedevel -Uversiononly -Duseshrplib -Duse64bitint -Duselongdouble -Uusethreads -Uusemultiplicity -Dprefix=/opt/perl-5.19.4 -Dsiteprefix=/opt/perl-5.19.4 -Dvendorprefix=/opt/perl-5.19.4/vendor -Doptimize=-ggdb -O2 -Dcccdlflags=-fPIC -O2 -pipe'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=undef, uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-ggdb -O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.2', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.13'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/opt/perl-5.19.4/lib/5.19.4/i686-linux-64int-ld/CORE'
    cccdlflags='-fPIC -O2 -pipe', lddlflags='-shared -ggdb -O2 -L/usr/local/lib -fstack-protector'


---
@INC for perl 5.19.4:
    /opt/perl-5.19.4/lib/site_perl/5.19.4/i686-linux-64int-ld
    /opt/perl-5.19.4/lib/site_perl/5.19.4
    /opt/perl-5.19.4/vendor/lib/vendor_perl/5.19.4/i686-linux-64int-ld
    /opt/perl-5.19.4/vendor/lib/vendor_perl/5.19.4
    /opt/perl-5.19.4/lib/5.19.4/i686-linux-64int-ld
    /opt/perl-5.19.4/lib/5.19.4
    .

---
Environment for perl 5.19.4:
    HOME=/root
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/perl-5.19.4/bin:/root/pub/i686-pc-linux-gnu/bin:/root/pub/common/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/games:/opt/geoip/bin:/opt/httpd/bin:/opt/perl/bin
    PERL5LIB=
    PERL5OPT=
    PERL5_CPANPLUS_IS_RUNNING=5158
    PERL5_CPAN_IS_RUNNING=5158
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh


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