Skip to content

Commit

Permalink
S_fold_constants: folded sv should note be a PADTMP
Browse files Browse the repository at this point in the history
  • Loading branch information
richardleach committed Dec 13, 2022
1 parent b7a676e commit c93cb6a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -4976,14 +4976,11 @@ S_fold_constants(pTHX_ OP *const o)
is_stringify = type == OP_STRINGIFY && !o->op_folded;
op_free(o);
assert(sv);
if (is_stringify)
SvPADTMP_off(sv);
else if (!SvIMMORTAL(sv)) {
SvPADTMP_on(sv);
/* Do not set SvREADONLY(sv) here. newSVOP will call
* Perl_ck_svconst, which will do it. Setting it early
* here prevents Perl_ck_svconst from setting SvIsCOW(sv).*/
}
/* sv may have swiped the TARG from a PADTMP OP, but that flag
* should be off when sv is attached to the new CONST OP. */
SvPADTMP_off(sv);
/* Perl_ck_svconst will try to set READONLY and IsCOW flags on
* sv as part of the new CONST OP creation. */
newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv));
if (!is_stringify) newop->op_folded = 1;
return newop;
Expand Down

0 comments on commit c93cb6a

Please sign in to comment.