summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2019-02-06 10:37:58 +1100
committerSteve Hay <steve.m.hay@googlemail.com>2019-04-02 12:17:51 +0100
commit9f6706159c74bc4e54862ad6669ff9fe7f6f4edc (patch)
tree9d1a38dacaf0769b153a40fd8466dc27f2cfa92f
parent068de6b3983d5339e978256cf8476ef3d0add41f (diff)
downloadperl-9f6706159c74bc4e54862ad6669ff9fe7f6f4edc.tar.gz
(perl #133778) adjust MARK if we extend the stack in pp_repeat
for a list repeat in scalar/void context (cherry picked from commit d81b77352f66acde60db1b056b8eb3321b7b55fe)
-rw-r--r--pp.c3
-rw-r--r--t/op/repeat.t84
2 files changed, 85 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 33eac6040d..def1950857 100644
--- a/pp.c
+++ b/pp.c
@@ -1693,7 +1693,8 @@ PP(pp_repeat)
else {
dTOPss;
ASSUME(MARK + 1 == SP);
- XPUSHs(sv);
+ MEXTEND(SP, 1);
+ PUSHs(sv);
MARK[1] = &PL_sv_undef;
}
SP = MARK + 2;
diff --git a/t/op/repeat.t b/t/op/repeat.t
index 978916689b..fa7ce06904 100644
--- a/t/op/repeat.t
+++ b/t/op/repeat.t
@@ -6,7 +6,7 @@ BEGIN {
set_up_inc( '../lib' );
}
-plan(tests => 49);
+plan(tests => 50);
# compile time
@@ -192,3 +192,85 @@ fresh_perl_like(
eval q{() = (() or ((0) x 0)); 1};
is($@, "", "RT #130247");
+
+# yes, the newlines matter
+fresh_perl_is(<<'PERL', "", { stderr => 1 }, "(perl #133778) MARK mishandling");
+map{s[][];eval;0}<DATA>__END__
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+()x0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0
+PERL