|
|
b8876f |
From 702cf95bcb627f2b3b44fad409df7f0fd517af60 Mon Sep 17 00:00:00 2001
|
|
|
b8876f |
From: David Mitchell <davem@iabyn.com>
|
|
|
b8876f |
Date: Mon, 5 Dec 2016 14:54:44 +0000
|
|
|
b8876f |
Subject: [PATCH] assertion failure in ... or ((0) x 0))
|
|
|
b8876f |
MIME-Version: 1.0
|
|
|
b8876f |
Content-Type: text/plain; charset=UTF-8
|
|
|
b8876f |
Content-Transfer-Encoding: 8bit
|
|
|
b8876f |
|
|
|
b8876f |
Petr Pisar: Ported to 5.24.0:
|
|
|
b8876f |
|
|
|
b8876f |
commit 5aa240eab7dbaa91f98c2fee1f04b6c0b5a9b9e3
|
|
|
b8876f |
Author: David Mitchell <davem@iabyn.com>
|
|
|
b8876f |
Date: Mon Dec 5 14:54:44 2016 +0000
|
|
|
b8876f |
|
|
|
b8876f |
assertion failure in ... or ((0) x 0))
|
|
|
b8876f |
|
|
|
b8876f |
[perl #130247] Perl_rpeep(OP *): Assertion `oldop' failed
|
|
|
b8876f |
|
|
|
b8876f |
the 'x 0' optimising code in rpeep didn't expect the repeat expression
|
|
|
b8876f |
to occur on the op_other side of an op_next chain.
|
|
|
b8876f |
|
|
|
b8876f |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
b8876f |
---
|
|
|
b8876f |
op.c | 4 ++--
|
|
|
b8876f |
t/op/repeat.t | 11 ++++++++++-
|
|
|
b8876f |
2 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
b8876f |
|
|
|
b8876f |
diff --git a/op.c b/op.c
|
|
|
b8876f |
index d7b900e..018d90c 100644
|
|
|
b8876f |
--- a/op.c
|
|
|
b8876f |
+++ b/op.c
|
|
|
b8876f |
@@ -13573,10 +13573,10 @@ Perl_rpeep(pTHX_ OP *o)
|
|
|
b8876f |
&& kid->op_next->op_type == OP_REPEAT
|
|
|
b8876f |
&& kid->op_next->op_private & OPpREPEAT_DOLIST
|
|
|
b8876f |
&& (kid->op_next->op_flags & OPf_WANT) == OPf_WANT_LIST
|
|
|
b8876f |
- && SvIOK(kSVOP_sv) && SvIVX(kSVOP_sv) == 0)
|
|
|
b8876f |
+ && SvIOK(kSVOP_sv) && SvIVX(kSVOP_sv) == 0
|
|
|
b8876f |
+ && oldop)
|
|
|
b8876f |
{
|
|
|
b8876f |
o = kid->op_next; /* repeat */
|
|
|
b8876f |
- assert(oldop);
|
|
|
b8876f |
oldop->op_next = o;
|
|
|
b8876f |
op_free(cBINOPo->op_first);
|
|
|
b8876f |
op_free(cBINOPo->op_last );
|
|
|
b8876f |
diff --git a/t/op/repeat.t b/t/op/repeat.t
|
|
|
b8876f |
index bee7dac..c933475 100644
|
|
|
b8876f |
--- a/t/op/repeat.t
|
|
|
b8876f |
+++ b/t/op/repeat.t
|
|
|
b8876f |
@@ -6,7 +6,7 @@ BEGIN {
|
|
|
b8876f |
}
|
|
|
b8876f |
|
|
|
b8876f |
require './test.pl';
|
|
|
b8876f |
-plan(tests => 48);
|
|
|
b8876f |
+plan(tests => 49);
|
|
|
b8876f |
|
|
|
b8876f |
# compile time
|
|
|
b8876f |
|
|
|
b8876f |
@@ -183,3 +183,12 @@ fresh_perl_like(
|
|
|
b8876f |
{ },
|
|
|
b8876f |
'(1) x ~1',
|
|
|
b8876f |
);
|
|
|
b8876f |
+
|
|
|
b8876f |
+# [perl #130247] Perl_rpeep(OP *): Assertion `oldop' failed
|
|
|
b8876f |
+#
|
|
|
b8876f |
+# the 'x 0' optimising code in rpeep didn't expect the repeat expression
|
|
|
b8876f |
+# to occur on the op_other side of an op_next chain.
|
|
|
b8876f |
+# This used to give an assertion failure
|
|
|
b8876f |
+
|
|
|
b8876f |
+eval q{() = (() or ((0) x 0)); 1};
|
|
|
b8876f |
+is($@, "", "RT #130247");
|
|
|
b8876f |
--
|
|
|
b8876f |
2.7.4
|
|
|
b8876f |
|