develooper Front page | perl.perl5.porters | Postings from December 2007

Re: Segmentation faults in blead perl (r32579)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
December 6, 2007 02:30
Subject:
Re: Segmentation faults in blead perl (r32579)
Message ID:
20071206103003.GN23703@plum.flirble.org
On Wed, Dec 05, 2007 at 08:53:35PM +0100, Moritz Lenz wrote:
> The KindaPerl6 compiler can compile Perl 6 grammars to a mix of Perl 5
> regexes and code blocks.
> We found a segmentation fault while executing the emitted Perl 5 code.

> I compiled perl 5.10.0 with -DDEBUGGING and obtained a stack trace with gdb:
> 
> Program received signal SIGSEGV, Segmentation fault.
> Perl_cv_clone (proto=0x8af7e08) at pad.c:1506
> 1506                        SvREFCNT_inc_simple_void_NN(sv);
> (gdb) bt
> #0  Perl_cv_clone (proto=0x8af7e08) at pad.c:1506
> #1  0x080c3afa in Perl_pp_anoncode () at pp.c:481
> #2  0x080a00c8 in Perl_runops_standard () at run.c:38
> #3  0x080ecdcc in S_regtry (reginfo=0xbf8a0898, startpos=0xbf8a08c8)
>     at regexec.c:3652
> #4  0x080f43f8 in Perl_regexec_flags (prog=0x926ea48,
>     stringarg=0x926e920 "-> $param { Inf }", strend=0x926e931 "",
>     strbeg=0x926e920 "-> $param { Inf }", minend=0, sv=0x9264ce8, data=0x0,
>     flags=<value optimized out>) at regexec.c:2099
> #5  0x080a59ff in Perl_pp_match () at pp_hot.c:1330
> #6  0x080a00c8 in Perl_runops_standard () at run.c:38
> #7  0x0809c71a in perl_run (my_perl=0x814c008) at perl.c:2384
> #8  0x0805ed42 in main (argc=3, argv=0xbf8a0b14, env=0xbf8a0b24)
>     at perlmain.c:113
> (gdb) p sv
> $1 = (SV *) 0x80a8490
> (gdb) p *sv
> $2 = {sv_any = 0x56e58955, sv_refcnt = 283935571, sv_flags = 3059228043,
>   sv_u = {svu_iv = 882968596, svu_uv = 882968596, svu_rv = 0x34a10814,
>     svu_pv = 0x34a10814 <Address 0x34a10814 out of bounds>,
>     svu_array = 0x34a10814, svu_hash = 0x34a10814, svu_gp = 0x34a10814}}

>     osname=linux, osvers=2.6.23.1, archname=i686-linux
>     uname='linux trudi 2.6.23.1 #15 smp mon nov 5 02:32:55 cet 2007 i686
> gnulinux '
>     config_args='-de -DDEBUGGING'

What was curious was that on x86_64 I got an assertion failure earlier than
that:

Breakpoint 1, Perl_croak (
    pat=0x599f90 "Assertion %s failed: file \"pad.c\", line %d") at util.c:1434
1434        va_start(args, pat);
(gdb) up
#1  0x0000000000435f0c in Perl_cv_clone (proto=0x18c3008) at pad.c:1450
1450        assert(depth || SvTYPE(proto) == SVt_PVFM);
(gdb) p depth
$1 = 0
(gdb) call Perl_sv_dump(proto)
SV = PVCV(0x17827c8) at 0x18c3008
  REFCNT = 2
  FLAGS = (PADMY,ANON,CLONE)
  COMP_STASH = 0xb124c8 "KindaPerl6::Grammar"
  START = 0x18c7140 ===> 0
  ROOT = 0x18d2c90
  GVGV::GV = 0x13413d8  "KindaPerl6::Grammar" :: "__ANON__"
  FILE = "(re_eval 1021)"
  DEPTH = 0
  FLAGS = 0xa0
  OUTSIDE_SEQ = 9240
  PADLIST = 0x18c3020
  OUTSIDE = 0x18a8738 (UNIQUE)
(gdb) call Perl_sv_dump(outside)
SV = PVCV(0x1781fa8) at 0x18a8738
  REFCNT = 4
  FLAGS = (FAKE,UNIQUE)
  COMP_STASH = 0xb124c8 "KindaPerl6::Grammar"
  START = 0x18be790 ===> 0
  ROOT = 0x18bfd10
  GVGV::GV = 0x1337538  "KindaPerl6::Grammar" :: "INIT"
  FILE = "compiled/perl5-kp6-kp6/lib/KindaPerl6/Grammar/Sub.pm"
  DEPTH = 0
  FLAGS = 0x100
  OUTSIDE_SEQ = 9215
  PADLIST = 0x18a8798
  OUTSIDE = 0x1855350 (UNIQUE)


If I run under -Dt I get about 300 meg of trace output (you have been warned)
and then it crashes here:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000468717 in Perl_debop (o=0x1bbe9a0) at dump.c:1976
1976                sv = *av_fetch(comppad, o->op_targ, FALSE);
(gdb)
(gdb) call Perl_sv_dump(comppad)
(gdb) 

and if I look at the redirected stderr, I see:

(compiled/perl5-kp6-kp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm:348)        return
(compiled/perl5-kp6-kp6/lib/KindaPerl6/Runtime/Perl5/MOP.pm:169)        leavesub
((re_eval 1586):7)      return
((re_eval 1586):13)     padsvSV = PVAV(0x19a6600) at 0x1b262a0
  REFCNT = 1
  FLAGS = ()
  ARRAY = 0x1ca6d70
  FILL = 10
  MAX = 10
  ARYLEN = 0x0
  FLAGS = (REAL)

So it's clear that that av_fetch returned NULL.

So something is messed up in the pads, but I have no idea what.

Nicholas Clark

Thread Previous | 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