List Info

Thread: Warning and segfault when using use constant and use sub




Warning and segfault when using use constant and use sub
user name
2007-09-20 17:22:47
# New Ticket Created by  sreziccpan.org 
# Please include the string:  [perl #45607]
# in the subject line of all future correspondence about
this issue. 
# <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45607 >


This is a bug report for perl from sreziccpan.org,
generated with the help of perlbug 1.36 running under perl
5.10.0.


------------------------------------------------------------
-----
The following script generates a new warning in perl5.10.0,
but not
in perl5.8.8:

     Constant subroutine main::BLA redefined at
/usr/perl5.10.0d/lib/5.10.0/subs.pm line 36.

Also, on exit there is a core dump

#!perl
use constant BLA => "foo";
use subs qw(BLA);
__END__

Here's the backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x000000000049623e in do_clean_named_objs (sv=0x6e8b38) at
sv.c:463
463             if ((
(gdb) bt
#0  0x000000000049623e in do_clean_named_objs (sv=0x6e8b38)
at sv.c:463
#1  0x0000000000495e95 in S_visit (f=0x496100
<do_clean_named_objs>, 
    flags=32777, mask=49407) at sv.c:387
#2  0x00000000004962f3 in Perl_sv_clean_objs () at sv.c:498
#3  0x000000000047f7a8 in perl_destruct (my_perl=0x6b9040)
at perl.c:767
#4  0x000000000041af80 in main (argc=2, argv=0x7fffffffe058,

    env=0x7fffffffe070) at perlmain.c:115

Regards,
	Slaven

------------------------------------------------------------
-----
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.10.0:

Configured by eserte at Wed Sep 19 23:41:00 CEST 2007.

Summary of my perl5 (revision 5 version 10 subversion 0
patch 31894) configuration:
  Platform:
    osname=freebsd, osvers=6.2-release,
archname=amd64-freebsd
    uname='freebsd biokovo-amd64.herceg.de 6.2-release
freebsd 6.2-release #0: fri jan 12 08:32:24 utc 2007
rootportnoy.cse.buffalo.edu:usrobjusrsrcsysgeneric amd64
'
    config_args='-Dprefix=/usr/perl5.10.0 -D cc=ccache cc
-Dgccansipedantic -de'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define,
usesocks=undef
    use64bitint=define, use64bitall=define,
uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='ccache cc', ccflags ='-DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-I/usr/local/include',
    optimize='-O2 -pipe',
    cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H
-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.4.6 [FreeBSD] 20060305',
gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8,
byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define,
longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8,
Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='ccache cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lgdbm -lm -lcrypt -lutil -lc
    perllibs=-lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,
ccdlflags=' '
    cccdlflags='-DPIC -fPIC', lddlflags='-shared 
-L/usr/local/lib'

Locally applied patches:
    DEVEL

---
INC
for perl 5.10.0:
    /usr/perl5.10.0/lib/5.10.0/amd64-freebsd
    /usr/perl5.10.0/lib/5.10.0
    /usr/perl5.10.0/lib/site_perl/5.10.0/amd64-freebsd
    /usr/perl5.10.0/lib/site_perl/5.10.0
    .

---
Environment for perl 5.10.0:
    HOME=/home/e/eserte
    LANG (unset)
    LANGUAGE (unset)
    LC_ALL=de_DE.ISO8859-1
    LC_CTYPE=de_DE.ISO8859-1
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
   
PATH=/usr/X11R6/bin:/usr/X11/bin:/usr/local/bin:/usr/bin:/bi
n:/usr/gnu/bin:/usr/TeX/bin:/usr/local/sbin:/usr/sbin:/sbin:
/usr/local/pilot/bin:/home/e/eserte/bin/FreeBSD:/home/e/eser
te/bin/sh:/home/e/eserte/bin:/usr/X386/bin:/usr/games:/home/
e/eserte/devel
    PERL_BADLANG (unset)
    PERL_HTML_DISPLAY_CLASS=HTML:isplay::
Mozilla
    SHELL=/bin/tcsh


Re: Warning and segfault when using use constant and use sub
user name
2007-09-21 06:25:44
On Thu, Sep 20, 2007 at 03:22:47PM -0700, srezic  cpan.
org wrote:
> # New Ticket Created by  sreziccpan.org 
> # Please include the string:  [perl #45607]
> # in the subject line of all future correspondence
about this issue. 
> # <URL: h
ttp://rt.perl.org/rt3/Ticket/Display.html?id=45607 >
> 
> 
> This is a bug report for perl from sreziccpan.org,
> generated with the help of perlbug 1.36 running under
perl 5.10.0.
> 
> 
>
------------------------------------------------------------
-----
> The following script generates a new warning in
perl5.10.0, but not
> in perl5.8.8:
> 
>      Constant subroutine main::BLA redefined at
/usr/perl5.10.0d/lib/5.10.0/subs.pm line 36.
> 
> Also, on exit there is a core dump
> 
> #!perl
> use constant BLA => "foo";
> use subs qw(BLA);

Mmm, that line probably shouldn't warn:

sub import {
    my $callpack = caller;
    my $pack = shift;
    my imports = _;
    foreach $sym (imports) {
        *{"$::$sym"} =
&{"$::$sym"};
    }
};

but thinking about the implementation, and what happens
when, it might be
tricky to stop it from warning.

> __END__
> 
> Here's the backtrace:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x000000000049623e in do_clean_named_objs (sv=0x6e8b38)
at sv.c:463
> 463             if ((
> (gdb) bt
> #0  0x000000000049623e in do_clean_named_objs
(sv=0x6e8b38) at sv.c:463
> #1  0x0000000000495e95 in S_visit (f=0x496100
<do_clean_named_objs>, 
>     flags=32777, mask=49407) at sv.c:387
> #2  0x00000000004962f3 in Perl_sv_clean_objs () at
sv.c:498
> #3  0x000000000047f7a8 in perl_destruct
(my_perl=0x6b9040) at perl.c:767
> #4  0x000000000041af80 in main (argc=2,
argv=0x7fffffffe058, 
>     env=0x7fffffffe070) at perlmain.c:115

I can get a stacktrace earlier than that:

==32668== Invalid read of size 4
==32668==    at 0x810EA48: Perl_sv_force_normal_flags
(sv.c:4123)
==32668==    by 0x80BE38F: S_save_magic (mg.c:92)
==32668==    by 0x80BE5C2: Perl_mg_get (mg.c:196)
==32668==    by 0x81038DD: Perl_sv_2pv_flags (sv.c:2561)
==32668==    by 0x8115E40: Perl_sv_cmp (sv.c:6061)
==32668==    by 0x8109479: S_glob_assign_ref (sv.c:3302)
==32668==    by 0x810B458: Perl_sv_setsv_flags (sv.c:3540)
==32668==    by 0x80E87BF: Perl_pp_sassign (pp_hot.c:184)
==32668==    by 0x80B249D: Perl_runops_debug (dump.c:1918)
==32668==    by 0x80E08F4: Perl_call_sv (perl.c:2593)
==32668==    by 0x80E6FF3: Perl_call_list (perl.c:5075)
==32668==    by 0x806F118: S_process_special_blocks
(op.c:5626)
==32668==    by 0x806EF56: Perl_newATTRSUB (op.c:5599)
==32668==    by 0x8067C84: Perl_utilize (op.c:3757)
==32668==    by 0x823056E: Perl_yyparse (perly.y:654)
==32668==    by 0x80DEEE4: S_parse_body (perl.c:2180)
==32668==    by 0x80DD976: perl_parse (perl.c:1618)
==32668==    by 0x805EF15: main (perlmain.c:111)
==32668==  Address 0xC is not stack'd, malloc'd or
(recently) free'd
==32668==
==32668== Process terminating with default action of signal
11 (SIGSEGV)

Not sure why, and not time today to investigate.

Nicholas Clark

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )