This is a bug report for perl from l...@dijkmat.nl,
generated with the help of perlbug 1.34 running under perl v5.8.2.
-----------------------------------------------------------------
[Please enter your report here]
in 5.8.0, the following neatly returns an error message.
-bash-2.05b$ perl5.8.0 -MList::Util=first -e 'first {return 1} (1)'
Can't return outside a subroutine at -e line 1.
in 5.8.1 and higher (including 5.8.4-RC1 and 5.9.0) gives a segfault:
$ valgrind perl5.8.3 -MList::Util=first -e 'first {return 1} (1)'
==18250== Invalid read of size 4
==18250== at 0x80CC91E: Perl_pp_entersub (pp_hot.c:2852)
==18250== by 0x80AF46A: Perl_runops_debug (dump.c:1438)
==18250== by 0x80624D7: S_run_body (perl.c:1857)
==18250== by 0x8062066: perl_run (perl.c:1776)
==18250== Address 0x0 is not stack'd, malloc'd or free'd
Segmentation fault
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
This perlbug was built using Perl v5.8.3 - Wed Jan 14 23:55:23 CET 2004
It is being executed now by Perl v5.8.2 - Fri Nov 7 13:22:20 CET 2003.
Site configuration information for perl v5.8.2:
Configured by liz at Fri Nov 7 13:22:20 CET 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
Platform:
osname=linux, osvers=2.4.20-8, archname=i686-linux
uname='linux cadier.hsyndicate.com 2.4.20-8 #1 thu mar 13
17:54:28 est 2003 i686 i686 i386 gnulinux '
config_args='-de'
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='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O3',
cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux
3.2.2-5)', 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 -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
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.2:
/usr/local/lib/perl5/5.8.2/i686-linux
/usr/local/lib/perl5/5.8.2
/usr/local/lib/perl5/site_perl/5.8.2/i686-linux
/usr/local/lib/perl5/site_perl/5.8.2
/usr/local/lib/perl5/site_perl/5.8.1/i686-linux
/usr/local/lib/perl5/site_perl/5.8.1
/usr/local/lib/perl5/site_perl
.
---
Environment for perl v5.8.2:
HOME=/home/liz
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/mysql/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/liz/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
Blame analysis:
----Program----
use List::Util qw=first=;
first {return 1} (1)
----Output of .../pDGfVX1/perl-5.8.0@18075/bin/perl----
Can't return outside a subroutine at tests/liz_first.pl line 2.
----EOF ($?='65280')----
----Output of .../ptxQFdw/perl-5.8.0@18076/bin/perl----
----EOF ($?='11')----
Change 18076 by gbarr@monty on 2002/11/03 10:11:18
Update to Scalar-List-Utils 1.08
--
andreas
Well, the direct segfault happens because the return pops a SUB context
off the stack, then the loop in first() also tries to pop it off.
Not sure of the best way of fixing this.
--
"There's something wrong with our bloody ships today, Chatfield."
Admiral Beatty at the Battle of Jutland, 31st May 1916.