Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"map" sometimes uses only the last mapped value #8407

Closed
p5pRT opened this issue Apr 17, 2006 · 6 comments

Comments

@p5pRT
Copy link

commented Apr 17, 2006

Migrated from rt.perl.org#38935 (status was 'resolved')

Searchable as RT38935$

@p5pRT

This comment has been minimized.

Copy link
Author

commented Apr 17, 2006

From mb29450@suttles.sfbay.sun.com

Created by Martin.Buchholz@sun.com

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

Perl Info

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Apr 17, 2006

From @pjcj

On Mon, Apr 17, 2006 at 10​:05​:55AM -0700, mb29450@​suttles.sfbay.sun.com wrote​:

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

@p5pRT

This comment has been minimized.

Copy link
Author

commented Apr 17, 2006

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Author

commented Apr 17, 2006

From @iabyn

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"

@p5pRT

This comment has been minimized.

Copy link
Author

commented Apr 18, 2006

From @andk

On Tue, 18 Apr 2006 00​:47​:29 +0100, Dave Mitchell <davem@​iabyn.com> said​:

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

binary search shows it's broken by 1789. Wow what a historic patch​:)

----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

@p5pRT

This comment has been minimized.

Copy link
Author

commented May 16, 2008

p5p@spam.wizbit.be - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.