develooper Front page | perl.perl5.porters | Postings from August 2001

[ID 20010822.001] Freeing pads after parse error

Thread Next
Simon Cozens
August 22, 2001 02:35
[ID 20010822.001] Freeing pads after parse error
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.33 running under perl v5.6.1.

[Please enter your report here]

This was reported to me by Ganesh Sittampalam. Here's "bug":

sub blat {
    sub {
	     or 1;
	     or &baz;

This segfaults, without an error message. I think it is something
to do with the save stack and PL_comppad. If I disable leave_scope
in the case of SAVEt_COMPPAD when PL_error_count > 0, I get an error
message as expected, but I also get a pad_free panic.

This may be related to the comment in pp_ctl.c:
    /* I was having segfault trouble under Linux 2.2.5 after a
       parse error occured.  (Had to hack around it with a test
       for PL_error_count == 0.)  Solaris doesn't segfault --
       not sure where the trouble is yet.  XXX */

Here's the debugging:

simon@riot-act ~/perl % ./perl -DX bug
Pad 0x815b998 alloc 1 for entersub
Pad 0x815b998 alloc 2 for concat
Pad 0x815b998 alloc 3 for entersub
Pad 0x8164908 alloc 4 for entersub
Pad 0x815b958 free 2
Pad 0x815b958 free 3
Pad 0x815b958 free 4
zsh: 8817 segmentation fault  ./perl -DX bug
simon@riot-act ~/perl % gdb ./perl
GNU gdb 5.0.90-cvs (MI_OUT)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) run bug
Starting program: /home/simon/perl/./perl bug

Program received signal SIGSEGV, Segmentation fault.
0x08087bfc in Perl_pad_free (po=4) at op.c:559
559             SvPADTMP_off(PL_curpad[po]);
(gdb) bt
#0  0x08087bfc in Perl_pad_free (po=4) at op.c:559
#1  0x080880d8 in Perl_op_clear (o=0x81648f8) at op.c:867
#2  0x08087e42 in Perl_op_free (o=0x81648f8) at op.c:736
#3  0x08087de5 in Perl_op_free (o=0x8164950) at op.c:724
#4  0x08087de5 in Perl_op_free (o=0x8164978) at op.c:724
#5  0x08087de5 in Perl_op_free (o=0x81649d8) at op.c:724
#6  0x08092394 in Perl_newATTRSUB (floor=109, o=0x81640c0, proto=0x0, attrs=0x0, block=0x81649d8) at op.c:4809
#7  0x08084683 in Perl_yyparse () at perly.y:355
#8  0x0805f672 in S_parse_body (env=0x0, xsinit=0x805c4a4 <xs_init>) at perl.c:1434
#9  0x0805ea63 in perl_parse (my_perl=0x8157c50, xsinit=0x805c4a4 <xs_init>, argc=2, argv=0xbffff95c, env=0x0) at perl.c:995
#10 0x0805c42f in main (argc=2, argv=0xbffff95c, env=0xbffff968) at perlmain.c:74
#11 0x4007746b in __libc_start_main () from /lib/

[Please do not change anything below this line]
Site configuration information for perl v5.6.1:

Configured by bod at Fri Jun 22 18:58:01 EST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
    osname=linux, osvers=2.4.5-ac9, archname=i386-linux
    uname='linux duende 2.4.5-ac9 #1 thu jun 21 00:52:39 est 2001 i686 unknown '
    config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Dotherlibdirs=/usr/lib/perl5/5.6:/usr/lib/perl5/5.005 -Duseshrplib -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.4 20010604 (Debian prerelease)', 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, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt
    perllibs=-ldl -lm -lc -lcrypt
    libc=/lib/, so=so, useshrplib=true,
  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.6.1:

Environment for perl v5.6.1:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About