summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-24 21:28:36 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-07-25 23:48:01 -0700
commitda9e430b54f7fcb43be1674882e31b92f2aa8253 (patch)
tree373c3b6702d80b68e8a3aa43f4216736dbd1cc41 /pp.c
parent706a6ebcf667fec4e1457b7ad601645a3aaa7764 (diff)
downloadperl-da9e430b54f7fcb43be1674882e31b92f2aa8253.tar.gz
[perl #78194] Make x copy PADTMPs in lv cx
So that \(("$a")x2) will give two references to the same scalar, the way that \(($a)x2) does.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/pp.c b/pp.c
index 99f7d1fa07..e47500f1d4 100644
--- a/pp.c
+++ b/pp.c
@@ -1657,6 +1657,7 @@ PP(pp_repeat)
static const char* const oom_list_extend = "Out of memory during list extend";
const I32 items = SP - MARK;
const I32 max = items * count;
+ const U8 mod = PL_op->op_flags & OPf_MOD;
MEM_WRAP_CHECK_1(max, SV*, oom_list_extend);
/* Did the max computation overflow? */
@@ -1690,7 +1691,11 @@ PP(pp_repeat)
}
#else
if (*SP)
+ {
+ if (mod && SvPADTMP(*SP) && !IS_PADGV(*SP))
+ *SP = sv_mortalcopy(*SP);
SvTEMP_off((*SP));
+ }
#endif
SP--;
}