FAQ
# New Ticket Created by perlbug@der-pepe.de
# Please include the string: [perl #41716]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41716 >


This is a bug report for perl from perlbug@der-pepe.de,
generated with the help of perlbug 1.35 running under perl v5.8.7.


-----------------------------------------------------------------

This script results in a strange error on perl 5.8.8 built for i686-linux.

#!/usr/bin/perl
use strict;
use warnings;

my @examples = (
{
name => 'Test Eins',
},
{
name => 'Test Zwei',
},
);

my @do_examples = (0, 1);

for my $foo (@examples[@do_examples]) {
my $testname = $foo->{name}; # line 17
print "$testname...\n";
local $@;
eval {
die 'hallo';
17;
} or do {
warn;
};
}

The output is:

Test Eins...
hallo at /tmp/test.pl line 21.
...caught at /tmp/test.pl line 24.
Can't use string ("1") as a HASH ref while "strict refs" in use at /tmp/test.pl line 17.

Apparently, $foo is set to 1, though it is never written to.

The error will disappear if you
* don't use an array slice but the whole array in the for loop
* remove warn or die
* give an argument to warn.

This couldn't be reproduced on perl 5.8.5.

-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.8.7:

Configured by Gentoo at Sat Nov 12 16:50:54 CET 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=linux, osvers=2.6.13.1, archname=i686-linux
uname='linux opaque 2.6.13.1 #2 sat sep 17 03:21:53 cest 2005 i686 amd-k7(tm) processor authenticamd gnulinux '
config_args='-des -Darchname=i686-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=i686-pc-linux-gnu-gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth= -Doptimize=-O3 -fomit-frame-pointer -march=i686 -pipe -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/var/tmp/portage/perl-5.8.7-r1/image//usr/share/man/man1 -Dinstallman3dir=/var/tmp/portage/perl-5.8.7-r1/image//usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dinc_version_list=5.8.0 5.8.0/i686-linux 5.8.2 5.8.2/i686-linux 5.8.4 5.8.4/i686-linux 5.8.5 5.8.5/i686-linux 5.8.6 5.8.6/i686-linux -Dcf_by=Gentoo -Ud_csh -Di_ndbm -Di_gdbm -Di_db'
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='i686-pc-linux-gnu-gcc', ccflags ='-fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3 -fomit-frame-pointer -march=i686 -pipe',
cppflags='-fno-strict-aliasing -pipe'
ccversion='', gccversion='3.4.3-20050110 (Gentoo Linux 3.4.3.20050110, ssp-3.4.3.20050110-0, pie-8.7.7)', 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='i686-pc-linux-gnu-gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.4.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.4'
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.8.7:
/etc/perl
/usr/lib/perl5/site_perl/5.8.7/i686-linux
/usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.4
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.7/i686-linux
/usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.2
/usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.7/i686-linux
/usr/lib/perl5/5.8.7
/usr/local/lib/site_perl
.

---
Environment for perl v5.8.7:
HOME=/home/pepe
LANG (unset)
LANGUAGE (unset)
LC_ALL=en_US.ISO8859-1
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/pepe/.bin:/bin:/usr/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.4.3-20050110:/opt/ghc/bin:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/usr/qt/3/bin:/usr/kde/3.4/bin:/usr/kde/3.2/bin:/usr/games/bin:/var/qmail/bin
PERL_BADLANG (unset)
SHELL=/bin/bash

Search Discussions

  • Andreas J. Koenig at Mar 8, 2007 at 10:47 am
    On Tue, 06 Mar 2007 13:24:04 -0800, "perlbug@der-pepe.de (via RT)" <perlbug-followup@perl.org> said:
    I can confirm this weird behaviour and I also could run a blame
    analysis. The result indicates it's coming from

    Change 26011 by rgs@marais on 2005/11/05 10:10:09

    Subject: Re: A surprising segfault
    From: SADAHIRO Tomoyuki <bqw10602@nifty.com>
    Date: Nov 5, 2005 5:54 AM
    Message-Id: <20051105135053.27D7.BQW10602@nifty.com>


    Travelling to the time that was so rich of summaries:

    http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005-11/msg00193.html

    A surprising segfault

    Robin Houston was rather bemused by:

    % perl -e 'map print(reverse), ("")x68'
    Segmentation fault

    and wondered why it was happening. Dave Mitchell promptly described
    the problem and fixed it. Sadahiro Tomoyuki found that many other
    "pp_*" functions exhibit similar behaviour and provided a patch to fix
    them too. Tels wanted tests.

    segfault
    http://xrl.us/ib7x

    How to kill perl
    http://www.perlmonks.org/index.pl?node_id=505817


    http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005-11/msg00432.html

    *A Surprising Segfault (continued)* In a followup to last week's
    thread, Dave Mitchell added that, like Rafael Garcia-Suarez, he
    believed the nature of the tests being applied to various "pp_*"
    functions may be dubious, which calls for more assertions in code and
    better tests.

    http://xrl.us/ifoh


    --
    andreas
  • Rafael Garcia-Suarez via RT at Mar 8, 2007 at 11:21 am
    That's fixed by change #30513. (Thanks Andreas for helping to find what
    was missing)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-porters @
categoriesperl
postedMar 6, '07 at 9:24p
activeMar 8, '07 at 11:21a
posts3
users2
websiteperl.org

People

Translate

site design / logo © 2021 Grokbase