summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-10-13 02:01:24 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-10-13 02:01:24 +0000
commit9d080a6634fd73a615f3f2bc087428102f6a5c3e (patch)
tree35d13662a100810c913938a5a85d5ba634e68948 /pp_hot.c
parentbe4f712a01f8cac0b4b4290efd894c00a5af5374 (diff)
downloadperl-9d080a6634fd73a615f3f2bc087428102f6a5c3e.tar.gz
force copy of substrings when matching against temporaries
p4raw-id: //depot/perl@1942
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 75bdb4fa98..701f4623da 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -863,9 +863,9 @@ PP(pp_match)
}
}
}
- safebase = (((gimme == G_ARRAY) || global || !rx->nparens)
- && !PL_sawampersand);
- safebase = safebase ? 0 : REXEC_COPY_STR ;
+ safebase = ((gimme != G_ARRAY && !global && rx->nparens)
+ || SvTEMP(TARG) || PL_sawampersand)
+ ? REXEC_COPY_STR : 0;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
SAVEINT(PL_multiline);
PL_multiline = pm->op_pmflags & PMf_MULTILINE;
@@ -1626,7 +1626,8 @@ PP(pp_subst)
&& SvTYPE(rx->check_substr) == SVt_PVBM
&& SvVALID(rx->check_substr))
? TARG : Nullsv);
- safebase = (!rx->nparens && !PL_sawampersand) ? 0 : REXEC_COPY_STR;
+ safebase = (rx->nparens || SvTEMP(TARG) || PL_sawampersand)
+ ? REXEC_COPY_STR : 0;
if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) {
SAVEINT(PL_multiline);
PL_multiline = pm->op_pmflags & PMf_MULTILINE;