diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-13 02:01:24 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-13 02:01:24 +0000 |
commit | 9d080a6634fd73a615f3f2bc087428102f6a5c3e (patch) | |
tree | 35d13662a100810c913938a5a85d5ba634e68948 /pp_hot.c | |
parent | be4f712a01f8cac0b4b4290efd894c00a5af5374 (diff) | |
download | perl-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.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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; |