From: Nicholas Clark Date: Mon, 26 Dec 2005 23:10:53 +0000 (+0000) Subject: Don't try to store PL_sv_undef in pads. (For now) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=052ca17e0976a44e0d2f61dba30b9c3180fcaccf;p=p5sagit%2Fp5-mst-13.2.git Don't try to store PL_sv_undef in pads. (For now) p4raw-id: //depot/perl@26494 --- diff --git a/op.c b/op.c index cb9b0e6..1e8e43a 100644 --- a/op.c +++ b/op.c @@ -6794,6 +6794,18 @@ Perl_peep(pTHX_ register OP *o) SvREADONLY_on(PAD_SVl(ix)); SvREFCNT_dec(cSVOPo->op_sv); } + else if (o->op_type == OP_CONST + && cSVOPo->op_sv == &PL_sv_undef) { + /* PL_sv_undef is hack - it's unsafe to store it in the + AV that is the pad, because av_fetch treats values of + PL_sv_undef as a "free" AV entry and will merrily + replace them with a new SV, causing pad_alloc to think + that this pad slot is free. (When, clearly, it is not) + */ + SvOK_off(PAD_SVl(ix)); + SvPADTMP_on(PAD_SVl(ix)); + SvREADONLY_on(PAD_SVl(ix)); + } else { SvREFCNT_dec(PAD_SVl(ix)); SvPADTMP_on(cSVOPo->op_sv);