develooper Front page | perl.perl5.porters | Postings from May 2012

[perl #36664] Strange behavior of shared array

Thread Previous
From:
Brian Fraser via RT
Date:
May 24, 2012 19:26
Subject:
[perl #36664] Strange behavior of shared array
Message ID:
rt-3.6.HEAD-7788-1337912769-206.36664-15-0@perl.org
On Tue Jul 26 20:09:21 2005, t-ikegami@aist.go.jp wrote:
> This is a bug report for perl from ikegami@artemis.a01.aist.go.jp,
> generated with the help of perlbug 1.35 running under perl v5.8.7.
> 
> 
> -----------------------------------------------------------------
> The following code snippet doesn't work as expected.
> 
> -----
> #!/usr/bin/perl
> use threads;
> use threads::shared;
> 
> our @List : shared = (1..5);
> my $v = 3.5;
> $v > 0;
> $List[3] = $v;
> printf "\@List[(3)] = %s\n", @List[(3)];
> printf "\$List[3]   = %s\n", $List[3];
> -----
> 
> The output looks like:
>   @List[(3)] = 3
>   $List[3]   = 3.5
> 
> Without "use threads", both @List[(3)] and $List[3] are stringified as
> "3.5".  The "$v > 0" line is somehow essential for the reproduction;
> when replaced with "$v > 0.5", the trouble vanishes.
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=low
> ---
> Site configuration information for perl v5.8.7:
> 
> Configured by ikegami at Thu Jun 16 22:21:09 JST 2005.
> 
> Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
>   Platform:
>     osname=linux, osvers=2.4.18-3, archname=i686-linux-thread-multi
>     uname='linux artemis.a01.aist.go.jp 2.4.18-3 #1 thu apr 18
>    07:37:53 edt 2002 i686 unknown '
>     config_args='-ds -e -Dprefix=/usr -Dusethreads'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=define use5005threads=undef useithreads=define
>    usemultiplicity=define
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>     usemymalloc=n, bincompat5005=undef
>   Compiler:
>     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
>    -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
>    -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
>     optimize='-O2',
>     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
>    -fno-strict-aliasing -pipe -I/usr/local/include
>    -I/usr/include/gdbm'
>     ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-
>    110)', gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
>     d_longlong=define, longlongsize=8, d_longdbl=define,
>    longdblsize=12
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
>    lseeksize=8
>     alignbytes=4, prototype=define
>   Linker and Libraries:
>     ld='cc', ldflags =' -L/usr/local/lib'
>     libpth=/usr/local/lib /lib /usr/lib
>     libs=-lnsl -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc
>     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
>     libc=/lib/libc-2.2.5.so, so=so, useshrplib=false,
>    libperl=libperl.a
>     gnulibc_version='2.2.5'
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
>     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
> 
> Locally applied patches:
> 
> 
> ---
> @INC for perl v5.8.7:
>     /home/ikegami/lib/perl
>     /usr/lib/perl5/5.8.7/i686-linux-thread-multi
>     /usr/lib/perl5/5.8.7
>     /usr/lib/perl5/site_perl/5.8.7/i686-linux-thread-multi
>     /usr/lib/perl5/site_perl/5.8.7
>     /usr/lib/perl5/site_perl/5.6.1
>     /usr/lib/perl5/site_perl/5.6.0
>     /usr/lib/perl5/site_perl
>     .
> 
> ---
> Environment for perl v5.8.7:
>     HOME=/home/ikegami
>     LANG=ja_JP.eucJP
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH=/opt/intel_fc_80/lib:/opt/intel/compiler70/ia32/lib
>     LOGDIR (unset)
>    
PATH=/home/ikegami/bin:/home/ikegami/util:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/opt/intel_fc_80/bin:/opt/intel/compiler70/ia32/bin:/usr/java/j2re1.4.1/bin:/usr/java/j2sdk1.4.1/bin:/home/ikegami/ninf/linux/bin:.
>     PERL5LIB=/home/ikegami/lib/perl
>     PERL_BADLANG (unset)
>     SHELL=/bin/zsh

Fixed in 5.14.2 and 5.16.0, so I'm marking this as resolved.

(tangentially related, I'm having issues pinpointing the commit that
fixed this. Can someone lend me some bisect.pl-fu?)


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

Thread Previous


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