Closed p5pRT closed 20 years ago
This is a bug report for perl from jtobey@feynman.localnet\, generated with the help of perlbug 1.27 running under perl v5.5.650.
The following program unexpectedly prints "undefined":
my ($x\, $y); $z = 1; $x = $y = 1 + $z; print "undefined" unless defined $y;
This behavior affects Perl 5.00563 and 5.5.560\, but not 5.00503. It happens only if $x and $y are both declared with "my"\, and the right side of the assignment is a compound expression (not just "1" or "$z").
The deparsed output is interesting:
$ perl -MO=Deparse -e 'my ($x\, $y); $x = $y = 1 + $z;' my($x\, $y); $x = 1 + $z; -e syntax OK
-John
Site configuration information for perl v5.5.650:
Configured by jtobey at Fri Feb 11 02:13:31 EST 2000.
Summary of my perl5 (revision 5.0 version 5 subversion 650) configuration: Platform: osname=linux\, osvers=2.2.14pre16\, archname=i686-linux uname='linux feynman 2.2.14pre16 #1 thu dec 23 19:33:36 est 1999 i686 unknown ' config_args='-Dcc=gcc -Dprefix=/usr/local -Doptimize=-g -O2 -ders' hint=recommended\, useposix=true\, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usesocks=undef useperlio=undef d_sfio=undef use64bits=undef uselargefiles=define usemultiplicity=undef Compiler: cc='gcc'\, optimize='-g -O2'\, gccversion=2.95.2 19991109 (Debian GNU/Linux) cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -fno-strict-aliasing -I/usr/local/include' stdchar='char'\, d_stdstdio=define\, usevfork=false intsize=4\, longsize=4\, ptrsize=4\, doublesize=8 d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12 alignbytes=4\, usemymalloc=n\, prototype=define Linker and Libraries: ld='gcc'\, ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt libc=/lib/libc-2.1.2.so\, so=so\, useshrplib=false\, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic' cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
@INC for perl v5.5.650: /usr/local/lib/perl5/5.5.650/i686-linux /usr/local/lib/perl5/5.5.650 /usr/local/lib/perl5/site_perl/5.5.650/i686-linux /usr/local/lib/perl5/site_perl/5.5.650 /usr/local/lib/perl5/site_perl/5.005/i686-linux /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl .
Environment for perl v5.5.650: HOME=/home/jtobey LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/jtobey/bin:/jtobey/local/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/sbin:/sbin PERL_BADLANG (unset) SHELL=/bin/bash
John Tobey writes:
my \($x\, $y\); $z = 1; $x = $y = 1 \+ $z; print "undefined" unless defined $y;
This behavior affects Perl 5.00563 and 5.5.560\, but not 5.00503. It happens only if $x and $y are both declared with "my"\, and the right side of the assignment is a compound expression (not just "1" or "$z").
The deparsed output is interesting:
$ perl \-MO=Deparse \-e 'my \($x\, $y\); $x = $y = 1 \+ $z;' my\($x\, $y\); $x = 1 \+ $z; \-e syntax OK
Oups\, the optimizer was removing the assignment *twice* for the same operation.
Sorry\, Ilya
Migrated from rt.perl.org#2137 (status was 'resolved')
Searchable as RT2137$