Skip to content

Commit c93cb6a

Browse files
committed
S_fold_constants: folded sv should note be a PADTMP
1 parent b7a676e commit c93cb6a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

op.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4976,14 +4976,11 @@ S_fold_constants(pTHX_ OP *const o)
49764976
is_stringify = type == OP_STRINGIFY && !o->op_folded;
49774977
op_free(o);
49784978
assert(sv);
4979-
if (is_stringify)
4980-
SvPADTMP_off(sv);
4981-
else if (!SvIMMORTAL(sv)) {
4982-
SvPADTMP_on(sv);
4983-
/* Do not set SvREADONLY(sv) here. newSVOP will call
4984-
* Perl_ck_svconst, which will do it. Setting it early
4985-
* here prevents Perl_ck_svconst from setting SvIsCOW(sv).*/
4986-
}
4979+
/* sv may have swiped the TARG from a PADTMP OP, but that flag
4980+
* should be off when sv is attached to the new CONST OP. */
4981+
SvPADTMP_off(sv);
4982+
/* Perl_ck_svconst will try to set READONLY and IsCOW flags on
4983+
* sv as part of the new CONST OP creation. */
49874984
newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv));
49884985
if (!is_stringify) newop->op_folded = 1;
49894986
return newop;

0 commit comments

Comments
 (0)