Subject: | Segfault |
Date: | Sun, 19 Sep 2010 17:22:28 -0700 |
To: | bug-B-Size [...] rt.cpan.org |
From: | Father Chrysostomos <sprout [...] cpan.org> |
This was reported as a perl bug (<http://rt.perl.org/rt3/Ticket/Display.html?id=52284>). According to Reini Urban, this is actually a bug in B::Size.
This script crashes.
sub z{
#must be local
my ($ref, $self);
#must be local _and_ initialized
#here's version from original code
#but '= (1..3)' suits as well
my(@keys) = keys(%$ref);
#these 2 lines must be together
$ref = $ref->{$keys[0]};
$self->{rootname} = $keys[0];
}
use B::TerseSize;
#B::debug(undef, 1);
$cv = B::svref_2object(\&{"main::z"});
B::walkoptree_slow($cv->ROOT, "op_size");
__END__
These notes might be helpful:
On Mon Mar 31 13:10:53 2008, rurban wrote:
Show quoted text
> B::Size failure. Please report there.
>
> SVOP's are beasts. Esp. with this GV.
> See http://www.perlfoundation.org/perl5/index.cgi?optree_guts
>
> However with my threaded perl aelemfast is no SVOP,
> it's a PADOP, so the sv access does not fail. Need to check this with a
> non-threaded perl, but I have non.
>
> But I doubt that is a core failure, I would blame B::Size.
> It should check if the op_flag is SPECIAL. Only then there's a SV,
> otherwise a PAD at op_targ.
>
> ...
>
> $ perl bug52284.pl
> walkoptree: 0. UNOP (0x681738) leavesub
> walkoptree: 1. LISTOP (0x681180) lineseq
> walkoptree: 2. COP (0x680eb8) nextstate
> walkoptree: 2. LISTOP (0x675358) list
> walkoptree: 3. OP (0x681140) pushmark
> walkoptree: 3. OP (0x6810c8) padsv
> walkoptree: 3. OP (0x681110) padsv
> walkoptree: 2. COP (0x681308) nextstate
> walkoptree: 2. BINOP (0x6812e0) aassign
> walkoptree: 3. UNOP (0x681298) null
> walkoptree: 4. OP (0x6812c0) pushmark
> walkoptree: 4. UNOP (0x675328) keys
> walkoptree: 5. UNOP (0x6811f8) rv2hv
> walkoptree: 6. OP (0x6811d8) padsv
> walkoptree: 3. UNOP (0x681250) null
> walkoptree: 4. OP (0x681278) pushmark
> walkoptree: 4. OP (0x6811a8) padav
> walkoptree: 2. COP (0x681480) nextstate
> walkoptree: 2. BINOP (0x681458) sassign
> walkoptree: 3. BINOP (0x681430) helem
> walkoptree: 4. UNOP (0x681410) rv2hv
> walkoptree: 5. OP (0x681388) padsv
> walkoptree: 4. UNOP (0x6813e8) null
> walkoptree: 5. PADOP (0x6813a8) aelemfast
> walkoptree: 5. OP (0x6813c8) null
> walkoptree: 3. OP (0x681368) padsv
> walkoptree: 2. COP (0x681608) nextstate
> walkoptree: 2. BINOP (0x6815e0) sassign
> walkoptree: 3. UNOP (0x6815b8) null
> walkoptree: 4. PADOP (0x681578) aelemfast
> walkoptree: 4. OP (0x681598) null
> walkoptree: 3. BINOP (0x681550) helem
> walkoptree: 4. UNOP (0x681530) rv2hv
> walkoptree: 5. OP (0x6814e0) padsv
> walkoptree: 4. SVOP (0x681510) const