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

[perl #29845] segfault in eval (5.8.x)

Thread Next
From:
Stas Bekman
Date:
May 25, 2004 02:21
Subject:
[perl #29845] segfault in eval (5.8.x)
Message ID:
rt-3.0.9-29845-88095.4.53681252128447@perl.org
# New Ticket Created by  Stas Bekman 
# Please include the string:  [perl #29845]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=29845 >


This is a bug report for perl from stas@stason.org,
generated with the help of perlbug 1.35 running under perl v5.8.4.


-----------------------------------------------------------------
[Please enter your report here]

% perl test.pl
Scalar found where operator expected at (eval 1) line 6, near "'refs'
         $parsed"
         (Missing operator before
         $parsed?)
Segmentation fault (core dumped)

code:

#---------------- start -----------------
my $code = <<'EOF';
sub handler {
     my $r = shift;
     plan $r;
     {
         no strict 'refs'
         $parsed->$method;
     }
}
EOF

eval { $code };
eval $code;
#---------------- end -----------------

yes, there is a syntax error. and yes there are two evals. The
segfault was appearing and disappearing as I was trying to make the
shortest possible test. Even comments were affecting the case. It seems that I 
can't make it shorter. Looks like some parser's problem.

back trace:

#0  0x40083540 in Perl_pad_free (my_perl=0x804d008, po=4) at pad.c:1166
1166            SvPADTMP_off(PL_curpad[po]);
(gdb) bt
#0  0x40083540 in Perl_pad_free (my_perl=0x804d008, po=4) at pad.c:1166
#1  0x4006dd92 in Perl_op_clear (my_perl=0x804d008, o=0x8051860) at op.c:460
#2  0x4006d91e in Perl_op_free (my_perl=0x804d008, o=0x8051860) at op.c:324
#3  0x4006d8bd in Perl_op_free (my_perl=0x804d008, o=0x8069210) at op.c:312
#4  0x40078d09 in Perl_newATTRSUB (my_perl=0x804d008, floor=157, o=0x8060258,
     proto=0x0, attrs=0x0, block=0x8069210) at op.c:4311
#5  0x4006b1cb in Perl_yyparse (my_perl=0x804d008) at perly.y:355
#6  0x400ffc1c in S_doeval (my_perl=0x804d008, gimme=128, startop=0x0,
     outside=0x804dd3c, seq=2) at pp_ctl.c:2816
#7  0x40102570 in Perl_pp_entereval (my_perl=0x804d008) at pp_ctl.c:3410
#8  0x4009993f in Perl_runops_debug (my_perl=0x804d008) at dump.c:1442
#9  0x4003eba6 in S_run_body (my_perl=0x804d008, oldscope=1) at perl.c:1921
#10 0x4003e5e8 in perl_run (my_perl=0x804d008) at perl.c:1840
#11 0x0804947e in main (argc=2, argv=0xbffff414, env=0xbffff420)
     at perlmain.c:86

reproducable with all ithreads-enabled 5.8.x perls. Doesn't happen
with non-threaded perls and not with blead perl.


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=core
     severity=low
---
Site configuration information for perl v5.8.4:

Configured by stas at Sat May  8 23:36:56 PDT 2004.

Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
   Platform:
     osname=linux, osvers=2.6.3-9mdk, archname=i686-linux-thread-multi
     uname='linux rabbit.stason.org 2.6.3-9mdk #1 fri apr 23 16:41:09 edt 2004 
i686 unknown unknown gnulinux '
     config_args='-des -Dprefix=/home/stas/perl/5.8.4-ithread -Dusethreads 
-Doptimize=-g -Duseshrplib -Dusedevel -Accflags=-DDEBUG_LEAKING_SCALARS'
     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 
-DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
     optimize='-g',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include 
-I/usr/include/gdbm'
     ccversion='', gccversion='3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)', 
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 -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/libc-2.3.3.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.3.3'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/home/stas/perl/5.8.4-ithread/lib/5.8.4/i686-linux-thread-multi/CORE'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.4:
     /home/stas/perl/5.8.4-ithread/lib/5.8.4/i686-linux-thread-multi
     /home/stas/perl/5.8.4-ithread/lib/5.8.4
     /home/stas/perl/5.8.4-ithread/lib/site_perl/5.8.4/i686-linux-thread-multi
     /home/stas/perl/5.8.4-ithread/lib/site_perl/5.8.4
     /home/stas/perl/5.8.4-ithread/lib/site_perl
     .

---
Environment for perl v5.8.4:
     HOME=/home/stas
     LANG=en_GB
     LANGUAGE=en_GB:en
     LC_ADDRESS=en_CA
     LC_COLLATE=en_GB
     LC_CTYPE=en_GB
     LC_IDENTIFICATION=en_CA
     LC_MEASUREMENT=en_CA
     LC_MESSAGES=en_GB
     LC_MONETARY=en_CA
     LC_NAME=en_CA
     LC_NUMERIC=en_CA
     LC_PAPER=en_CA
     LC_TELEPHONE=en_CA
     LC_TIME=en_GB
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/usr//bin:/bin:/usr/bin:.:/usr/local/bin:/usr/X11R6/bin/:/usr/games:/home/stas/bin:/home/stas/bin:/usr/local/bin:/usr/X11R6/bin:/usr/java/j2re1.4.0/bin/
     PERLDOC_PAGER=less -R
     PERL_BADLANG (unset)
     SHELL=/bin/tcsh


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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