develooper Front page | perl.perl5.porters | Postings from July 2008

[perl #56986] 5.8.8: bug in substr() as lvalue?

Thread Next
From:
Ulrich Windl
Date:
July 16, 2008 10:43
Subject:
[perl #56986] 5.8.8: bug in substr() as lvalue?
Message ID:
rt-3.6.HEAD-8814-1216212930-1095.56986-75-0@perl.org
# New Ticket Created by  "Ulrich Windl" 
# Please include the string:  [perl #56986]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56986 >


This is a bug report for perl from Ulrich.Windl@rz.uni-regensburg.de,
generated with the help of perlbug 1.35 running under perl v5.8.8.


-----------------------------------------------------------------
I think this is a Perl bug (HP-UX 11.31, Perl from HP (ActivePerl)). None of both 
Tests produces the proper results. I'd expect (6,0,20, 31) to be in @nums after 
the loop


Test 1:

$info = '4.IT';
my $a = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
while ($info) {
	my $c = substr($info, 0, 1) = '';
	print "index ", $c, "=", index($a, $c), "\n";
           	push(@nums, index($a, $c));
}
print "nums=", join(',', @nums), "\n";

Output:
index .=0
index I=20
index T=31
index =0
nums=0,20,31,0

Test 2:
$info = '4.IT';
while ($info) {
	print "index ", substr($info, 0, 1), "=", index($a, substr($info, 0, 1)), 
"\n";
            push(@nums, index($a, substr($info, 0, 1) = ''));
}
print "nums=", join(',', @nums), "\n";

Output:
index 4=6
index .=0
index I=20
index T=31
nums=0,20,31,0
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.8.8:

Configured by ActiveState at Tue Sep 19 13:45:19 PDT 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=hpux, osvers=11.22, archname=IA64.ARCHREV_0-thread-multi
    osname=hpux, osvers=11.22, archname=IA64.ARCHREV_0-thread-multi
    uname='hp-ux bigsur03 b.11.22 u ia64 1800516905 unlimited-user license '
    config_args='-ders -Dcc=cc -Dusethreads -Duseithreads -Ud_sigsetjmp -Uinstal
lusrbinperl -Ulocincpth= -Uloclibpth= -Dsh=/usr/bin/sh -Dd_attribut=undef -Dd_at
tribute_warn_unused_result=undef -Dd_u32align=define -Aprepend:libswanted=cl  -D
vendorprefix=/opt/perl_32 -Doptimize=-fast +DSitanium2 +Ofltacc=strict -Accflags
=+Z -Accflags=-DUSE_SITECUSTOMIZE -Duselargefiles -Accflags=-DNO_HASH_SEED -Dpre
fix=/opt/perl_32 -Dinc_version_list=5.8.7/$archname 5.8.7 5.8.6/$archname 5.8.6
5.8.4/$archname 5.8.4 5.8.3/$archname 5.8.3 5.8.2/$archname 5.8.2 5.8.1/$archnam
e 5.8.1 5.8.0/$archname 5.8.0 -Dsed=/usr/bin/sed -Duseshrplib -Dconfig_heavy=Con
fig_dynamic.pl -Dcf_by=ActiveState -Dcf_email=support@ActiveState.com'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=de
fine
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags =' -D_POSIX_C_SOURCE=199506L -D_REENTRANT -D_HPUX_SOURCE -
fPIC -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=
64  -fno-strict-aliasing -pipe',
    optimize='',
    cppflags='-D__STDC_EXT__ -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -D_REENTRA
NT -D_HPUX_SOURCE -DUSE_SITECUSTOMIZE -DNO_HASH_SEED -fno-strict-aliasing -pipe'
    ccversion='', gccversion='3.4.3', 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='gcc', ldflags =' -L/usr/lib/hpux32'
    libpth=/usr/lib/hpux32 /lib /usr/lib /usr/ccs/lib /usr/local/lib
    libs=-lcl -lnsl -lnm -lndbm -ldl -ldld -lm -lsec -lpthread -lc
    perllibs=-lcl -lnsl -lnm -ldl -ldld -lm -lsec -lpthread -lc
    libc=/usr/lib/hpux32/libc.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferr
ed '
    cccdlflags='-fPIC', lddlflags='-shared -static-libgcc -fPIC -L/usr/lib/hpux3
2'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    Iin_load_module moved for compatibility with build 806
    POSIX: Support the long hostname version of uname()
    Avoid signal flag SA_RESTART for older versions of HP-UX
    PerlEx support in CGI::Carp
    Less verbose ExtUtils::Install and Pod::Find
    Patch for CAN-2005-0448 from Debian with modifications
    Partly reverted 24733 to preserve binary compatibility
    28671 Define PERL_NO_DEV_RANDOM on Windows
    28376 Add error checks after execing PL_cshname or PL_sh_path
    28305 Pod::Html should not convert \"foo\" into ``foo''
    27736 Make perl_fini() run with Sun WorkShop compiler
    27619 Bug in Term::ReadKey being triggered by a bug in Term::ReadLine
    27549 Move DynaLoader.o into libperl.so
    27528 win32_pclose() error exit doesn't unlock mutex
    27527 win32_async_check() can loop indefinitely
    27515 ignore directories when searching @INC
    27359 Fix -d:Foo=bar syntax
    27210 Fix quote typo in c2ph
    27203 Allow compiling swigged C++ code
    27200 Make stat() on Windows handle trailing slashes correctly
    27194 Get perl_fini() running on HP-UX again
    27133 Initialise lastparen in the regexp structure
    27034 Avoid \"Prototype mismatch\" warnings with autouse
    26970 Make Passive mode the default for Net::FTP
    26921 Avoid getprotobyname/number calls in IO::Socket::INET
    26897,26903 Make common IPPROTO_* constants always available
    26670 Make '-s' on the shebang line parse -foo=bar switches
    26379 Fix alarm() for Windows 2003
    26087 Storable 0.1 compatibility
    25861 IO::File performace issue
    25084 long groups entry could cause memory exhaustion
    24699 ICMP_UNREACHABLE handling in Net::Ping

---
@INC for perl v5.8.8:
    /opt/perl_32/lib/5.8.8/IA64.ARCHREV_0-thread-multi
    /opt/perl_32/lib/5.8.8
    /opt/perl_32/lib/site_perl/5.8.8/IA64.ARCHREV_0-thread-multi
    /opt/perl_32/lib/site_perl/5.8.8
    /opt/perl_32/lib/site_perl
    /opt/perl_32/lib/vendor_perl/5.8.8/IA64.ARCHREV_0-thread-multi
    /opt/perl_32/lib/vendor_perl/5.8.8
    /opt/perl_32/lib/vendor_perl
    .

---
Environment for perl v5.8.8:
    HOME=/home/windl
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/contrib/Q4/b
in:/opt/ipf/bin:/opt/hparray/bin:/opt/nettladm/bin:/opt/fcms/bin:/opt/sec_mgmt/b
astille/bin:/opt/resmon/bin:/opt/gnome/bin:/usr/bin/X11:/opt/ignite/bin:/usr/con
trib/kwdb/bin:/opt/wbem/bin:/opt/wbem/sbin:/opt/graphics/common/bin:/opt/sec_mgm
t/spc/bin:/opt/java1.4/jre/bin:/opt/spb/bin:/opt/hpsmh/bin:/opt/upgrade/bin:/opt
/gwlm/bin:/opt/ssh/bin:/usr/contrib/bin/X11:/opt/perl/bin:/opt/sas/bin:/opt/atok
/bin:/opt/dsau/bin:/opt/dsau/sbin:/opt/firefox:/opt/mozilla:/opt/sfm/bin:/opt/sw
m/bin:/opt/swa/bin:/opt/hp-gcc/bin:/opt/drd/bin:/opt/perl_32/bin:/opt/perl_64/bi
n:/opt/thunderbird:/opt/caliper/bin:/opt/prm/bin:/opt/sentinel/bin:/opt/langtool
s/bin:/opt/hp-gcc/bin:/opt/langtools/bin
    PERL_BADLANG (unset)
    SHELL=/usr/bin/csh


Thread Next


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