Skip Menu |
 
Report information
Id: 38935
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: mb29450 [at] suttles.sfbay.sun.com
Cc:
AdminCc:

Operating System: Solaris
PatchStatus: (no value)
Severity: High
Type: core
Perl Version: 5.8.8
Fixed In: 5.11.0



Subject: "map" sometimes uses only the last mapped value
Date: Mon, 17 Apr 2006 10:04:45 -0700
To: perlbug [...] perl.org
From: Martin Buchholz <Martin.Buchholz [...] sun.com>
Download (untitled) / with headers
text/plain 4.3k
This is a bug report for perl from Martin.Buchholz@sun.com, generated with the help of perlbug 1.35 running under perl v5.8.8. ----------------------------------------------------------------- [Please enter your report here] The perl program below should print 6 identical lines, but one of them is different, which appears to be a very serious bug, perhaps in the optimization of "map". It appears to not be Solaris-specific. I also see this on Linux perl 5.6.1. $ perl <<'EOF' sub f1 { my ($f) = @_; my @z = ("$f"); for my $d (@z) {return $d} } sub f2 { my ($f) = @_; for my $d ("$f") {return $d} } sub f3 { for my $d (@_) {return $d} } print map {f1($_)} qw(x y z); print "\n"; print map {f2($_)} qw(x y z); print "\n"; print map {f3($_)} qw(x y z); print "\n"; for my $a (qw(x y z)) { print f1($a) } print "\n"; for my $a (qw(x y z)) { print f2($a) } print "\n"; for my $a (qw(x y z)) { print f3($a) } print "\n"; EOF xyz zzz xyz xyz xyz xyz [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=high --- Site configuration information for perl v5.8.8: Configured by mb29450 at Mon Apr 17 09:33:31 PDT 2006. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=solaris, osvers=2.9, archname=sun4-solaris uname='sunos suttles 5.9 generic_112233-05 sun4u sparc sunw,sun-blade-1000 ' config_args='-ds -e -Dprefix=/usr/local' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O', cppflags='-I/usr/local/include' ccversion='Sun C 5.8 2005/10/13', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/lib -L/usr/ccs/lib -L/u/devtools/sparc/SUNWspro/SS11_EA/prod/lib/v8plus -L/u/devtools/sparc/SUNWspro/SS11_EA/prod/lib -L/lib -L/usr/local/lib ' libpth=/usr/lib /usr/ccs/lib /u/devtools/sparc/SUNWspro/SS11_EA/prod/lib/v8plus /u/devtools/sparc/SUNWspro/SS11_EA/prod/lib /lib /usr/local/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib -L/u/devtools/sparc/SUNWspro/SS11_EA/prod/lib/v8plus -L/u/devtools/sparc/SUNWspro/SS11_EA/prod/lib -L/lib -L/usr/local/lib' Locally applied patches: --- @INC for perl v5.8.8: /usr/local/lib/perl5/5.8.8/sun4-solaris /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.6 /usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl/5.8.4/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl/5.8.3/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl/5.8.1/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.1 /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl . --- Environment for perl v5.8.8: HOME=/u/martin LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/u/martin/bin:/u/martin/bin/sun:/usr/java1.5.0/bin:/opt/Acrobat5/bin:/usr/local/bin:/usr/local/samba/bin:/usr/local/apache2/bin:/usr/sfw/bin:/opt/sfw/bin:/usr/dt/bin:/usr/openwin/bin:/usr/xpg4/bin:/usr/proc/bin:/usr/ccs/bin:/usr/bin:/sbin:/usr/sbin:/devtools/sparc/teamware/7.7/bin:/devtools/sparc/SUNWspro/SS11/bin PERL_BADLANG (unset) SHELL=/usr/bin/zsh
Subject: Re: [perl #38935] "map" sometimes uses only the last mapped value
Date: Mon, 17 Apr 2006 23:04:30 +0200
To: perl5-porters [...] perl.org
From: Paul Johnson <paul [...] pjcj.net>
On Mon, Apr 17, 2006 at 10:05:55AM -0700, mb29450@suttles.sfbay.sun.com wrote: Show quoted text
> The perl program below should print 6 identical lines, > but one of them is different, which appears to be a very > serious bug, perhaps in the optimization of "map". > It appears to not be Solaris-specific. > I also see this on Linux perl 5.6.1. > > $ perl <<'EOF' > sub f1 { > my ($f) = @_; > my @z = ("$f"); > for my $d (@z) {return $d} > } > > sub f2 { > my ($f) = @_; > for my $d ("$f") {return $d} > } > > sub f3 { > for my $d (@_) {return $d} > } > > print map {f1($_)} qw(x y z); print "\n"; > print map {f2($_)} qw(x y z); print "\n"; > print map {f3($_)} qw(x y z); print "\n"; > > for my $a (qw(x y z)) { print f1($a) } print "\n"; > for my $a (qw(x y z)) { print f2($a) } print "\n"; > for my $a (qw(x y z)) { print f3($a) } print "\n"; > EOF > xyz > zzz > xyz > xyz > xyz > xyz
Looks like this came in somewhere during 5.005. From the perls I have lying around the operation is correct in 5.004_05 but not in 5.005_04. It is still a problem in bleadperl. -- Paul Johnson - paul@pjcj.net http://www.pjcj.net
CC: perl5-porters [...] perl.org
Subject: Re: [perl #38935] "map" sometimes uses only the last mapped value
Date: Tue, 18 Apr 2006 00:47:29 +0100
To: Paul Johnson <paul [...] pjcj.net>
From: Dave Mitchell <davem [...] iabyn.com>
Download (untitled) / with headers
text/plain 370b
Show quoted text
> Looks like this came in somewhere during 5.005. From the perls I have > lying around the operation is correct in 5.004_05 but not in 5.005_04. > It is still a problem in bleadperl.
Looks like the TARG in pp_stringify is getting shared -- "You're so sadly neglected, and often ignored. A poor second to Belgium, When going abroad." -- Monty Python - "Finland"
CC: Paul Johnson <paul [...] pjcj.net>, perl5-porters [...] perl.org
Subject: Re: [perl #38935] "map" sometimes uses only the last mapped value
Date: Tue, 18 Apr 2006 21:38:29 +0200
To: Dave Mitchell <davem [...] iabyn.com>
From: andreas.koenig.gmwojprw [...] franz.ak.mind.de (Andreas J. Koenig)
Download (untitled) / with headers
text/plain 1.1k
Show quoted text
>>>>> On Tue, 18 Apr 2006 00:47:29 +0100, Dave Mitchell <davem@iabyn.com> said:
Show quoted text
>> Looks like this came in somewhere during 5.005. From the perls I have >> lying around the operation is correct in 5.004_05 but not in 5.005_04. >> It is still a problem in bleadperl.
Show quoted text
> Looks like the TARG in pp_stringify is getting shared
binary search shows it's broken by 1789. Wow what a historic patch:) Show quoted text
----Program---- sub f1 { my ($f) = @_; my @z = ("$f"); for my $d (@z) {return $d} } sub f2 { my ($f) = @_; for my $d ("$f") {return $d} } sub f3 { for my $d (@_) {return $d} } print map {f1($_)} qw(x y z); print "\n"; print map {f2($_)} qw(x y z); print "\n"; print map {f3($_)} qw(x y z); print "\n"; for my $a (qw(x y z)) { print f1($a) } print "\n"; for my $a (qw(x y z)) { print f2($a) } print "\n"; for my $a (qw(x y z)) { print f3($a) } print "\n"; ----Output of ...skTqpK/perl-5.005_51@1788/bin/perl---- xyz xyz xyz xyz xyz xyz ----EOF ($?='0')---- ----Output of ...dkeHLI/perl-5.005_51@1789/bin/perl---- xyz zzz xyz xyz xyz xyz ----EOF ($?='0')---- Change 1789 by gsar@aatma on 1998/09/18 18:01:37 delay freeing itervar so C<for $i (@a) { return($i) }> works -- andreas


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org