The following script segfaults with _17 ():
#!./perl
my $x;
BEGIN {
$x = sub {print "in sub.\n"; undef $x};
sub X::DESTROY { print "Destroying.\n"}
bless $x, 'X';
}
# At this moment refcount of $x and &$x are 1 (we need a closure for this
# because of a sub leak).
&$x();
print "x: `$x'.\n";
cx->blk_sub.dfoutgv = defoutgv; \
(void)SvREFCNT_inc(cx->blk_sub.dfoutgv)
+/* We muck with cxstack_ix since _dec may call a DESTROY, overwriting cx. */
+
#define POPSUB(cx) \
if (cx->blk_sub.hasargs) { /* put back old @_ */ \
GvAV(defgv) = cx->blk_sub.savearray; \
if (cx->blk_sub.hasargs) { \
SvREFCNT_inc((SV*)cx->blk_sub.argarray); \
} \
+ cxstack_ix++; \
SvREFCNT_dec((SV*)cx->blk_sub.cv); \
+ cxstack_ix--; \
} \
}