Front page | perl.perl5.porters |
Postings from September 2010
[perl #77766] Assignment to an element of an anonymous array which is part of a hash also changes a cloned hash
Thread Previous
|
Thread Next
From:
Tim Bolshaw
Date:
September 11, 2010 00:31
Subject:
[perl #77766] Assignment to an element of an anonymous array which is part of a hash also changes a cloned hash
Message ID:
rt-3.6.HEAD-5116-1284104746-889.77766-75-0@perl.org
# New Ticket Created by Tim Bolshaw
# Please include the string: [perl #77766]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77766 >
This is a bug report for perl from timothybolshaw@gmail.com,
generated with the help of perlbug 1.39 running under perl 5.12.1.
I think the assignment in the sample program below should cause the two
hashes to be given separate anonymous arrays,
but that does not happen.
#!/usr/bin/perl5.12.1
use strict;
use warnings;
my %h1 = ( x => [1,1], y => [1,1] );
my %h2 = %h1;
print "We expect h1 and h2 to be the same\n";
print "h1 before: ", join( ',', @{$h1{y}} ), "\n";
print "h2 before: ", join( ',', @{$h2{y}} ), "\n";
print "... and they are\n";
$h1{y}->[1] = 2;
print "Now, we expect h1 and h2 to be different\n";
print "h1 after: ", join( ',', @{$h1{y}} ), "\n";
print "h2 after: ", join( ',', @{$h2{y}} ), "\n";
print "... but alas they have both been modified by the assignment\n";
#(Circumvention: $h1{y} = [$h1{y}->[0], 2];)
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.12.1:
Configured by SYSTEM at Fri May 14 00:24:46 2010.
Summary of my perl5 (revision 5 version 12 subversion 1) configuration:
Platform:
osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=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='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX',
optimize='-MD -Zi -DNDEBUG -O1',
cppflags='-DWIN32'
ccversion='12.00.8804', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"C:\TEMP\perl---------please-run-the-install-script--------\lib\CORE"
-machine:x86'
libpth=\lib
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
comctl32.lib msvcrt.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
comctl32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl512.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf
-libpath:"C:\TEMP\perl---------please-run-the-install-script--------\lib\CORE"
-machine:x86'
Locally applied patches:
ACTIVEPERL_LOCAL_PATCHES_ENTRY
d956618 Make Term::ReadLine::findConsole fall back to STDIN if /dev/tty
can't be opened
321e50c Escape patch strings before embedding them in patchlevel.h
---
@INC for perl 5.12.1:
P:/ActivePerl1201/site/lib
P:/ActivePerl1201/lib
.
---
Environment for perl 5.12.1:
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=P:\ActivePerl1201\site\bin;P:\ActivePerl1201\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\GNU\GnuPG\pub
PERL_BADLANG (unset)
SHELL (unset)
Thread Previous
|
Thread Next