perl-XS-Parse-Keyword/XS-Parse-Keyword-0.17-Fix-t-infix.xs-failure-on-non-x86-platforms.patch
2021-09-24 13:58:32 +02:00

53 lines
1.6 KiB
Diff

From 2dfc35ab974d068d1e27e1ad146c114562a54a3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 24 Sep 2021 13:53:26 +0200
Subject: [PATCH] Fix t/infix.xs failure on non-x86 platforms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, an invocation of t::infix::addpairsfunc() warned and returned bad data:
$ perl -Iblib/{lib,arch} t/71infix-wrapper.t
ok 1 - add wrapper func
ok 2 - intersperse wrapper func
Use of uninitialized value in custom infix operator at t/71infix-wrapper.t line 15.
Use of uninitialized value in custom infix operator at t/71infix-wrapper.t line 15.
not ok 3 - addpairs wrapper func
# Failed test 'addpairs wrapper func'
# at t/71infix-wrapper.t line 26.
# Structures begin differing at:
# $got->[0] = '3'
# $expected->[0] = '4'
ok 4 - callchecker generated an OP_CUSTOM call
This error exhibited e.g. on aarch64 platform. This patch fixes it without
understanding what's going on.
CPAN RT#139445
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/infix.xs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/t/infix.xs b/t/infix.xs
index 5f1472e..c848470 100644
--- a/t/infix.xs
+++ b/t/infix.xs
@@ -108,7 +108,10 @@ OP *pp_addpairs(pTHX)
PUSHMARK(SP);
while(lhs_count || rhs_count) {
- mPUSHi(SvIV(*lhs) + SvIV(*rhs));
+ /* Without an intermediate storage, mPUSHi() reports an undefined value.
+ * CPAN RT#139445 */
+ IV o = SvIV(*lhs) + SvIV(*rhs);
+ mPUSHi(o);
lhs++; lhs_count--;
rhs++; rhs_count--;
--
2.31.1