|
|
|
@ -0,0 +1,273 @@
|
|
|
|
|
From 938b0810eb9e3be288a82ab54215abed76cc72f4 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: rpm-build <rpm-build>
|
|
|
|
|
Date: Wed, 22 Mar 2023 11:13:00 +0000
|
|
|
|
|
Subject: [PATCH] Fix riscv64 tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/eval.c b/eval.c
|
|
|
|
|
index 9e64452..37d0fa6 100644
|
|
|
|
|
--- a/eval.c
|
|
|
|
|
+++ b/eval.c
|
|
|
|
|
@@ -41,6 +41,8 @@ static int num_exec_hook = 0;
|
|
|
|
|
static Func_pre_exec pre_execute[MAX_EXEC_HOOKS];
|
|
|
|
|
static Func_post_exec post_execute = NULL;
|
|
|
|
|
|
|
|
|
|
+static double fix_nan_sign(double left, double right, double result);
|
|
|
|
|
+
|
|
|
|
|
extern void frame_popped();
|
|
|
|
|
|
|
|
|
|
int OFSlen;
|
|
|
|
|
@@ -1795,3 +1797,20 @@ init_interpret()
|
|
|
|
|
interpret = r_interpret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+/* fix_nan_sign --- fix NaN sign on RiscV */
|
|
|
|
|
+
|
|
|
|
|
+// See the thread starting at
|
|
|
|
|
+// https://lists.gnu.org/archive/html/bug-gawk/2022-09/msg00005.html
|
|
|
|
|
+// for why we need this function.
|
|
|
|
|
+
|
|
|
|
|
+static double
|
|
|
|
|
+fix_nan_sign(double left, double right, double result)
|
|
|
|
|
+{
|
|
|
|
|
+ if (isnan(left) && signbit(left))
|
|
|
|
|
+ return copysign(result, -1.0);
|
|
|
|
|
+ else if (isnan(right) && signbit(right))
|
|
|
|
|
+ return copysign(result, -1.0);
|
|
|
|
|
+ else
|
|
|
|
|
+ return result;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
diff --git a/interpret.h b/interpret.h
|
|
|
|
|
index d52d537..0a7beff 100644
|
|
|
|
|
--- a/interpret.h
|
|
|
|
|
+++ b/interpret.h
|
|
|
|
|
@@ -538,6 +538,7 @@ uninitialized_scalar:
|
|
|
|
|
plus:
|
|
|
|
|
t1 = TOP_NUMBER();
|
|
|
|
|
r = make_number(t1->numbr + x2);
|
|
|
|
|
+ r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
|
|
|
|
|
DEREF(t1);
|
|
|
|
|
REPLACE(r);
|
|
|
|
|
break;
|
|
|
|
|
@@ -552,6 +553,7 @@ plus:
|
|
|
|
|
minus:
|
|
|
|
|
t1 = TOP_NUMBER();
|
|
|
|
|
r = make_number(t1->numbr - x2);
|
|
|
|
|
+ r->numbr = fix_nan_sign(t1->numbr, x2, r->numbr);
|
|
|
|
|
DEREF(t1);
|
|
|
|
|
REPLACE(r);
|
|
|
|
|
break;
|
|
|
|
|
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
|
|
|
|
|
index 4c66285..f5abd62 100644
|
|
|
|
|
--- a/pc/Makefile.tst
|
|
|
|
|
+++ b/pc/Makefile.tst
|
|
|
|
|
@@ -196,7 +196,7 @@ GAWK_EXT_TESTS = \
|
|
|
|
|
gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
|
|
|
|
|
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
|
|
|
|
|
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
|
|
|
|
|
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
|
|
|
|
|
+ indirectcall indirectcall2 intarray iolint \
|
|
|
|
|
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
|
|
|
|
|
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
|
|
|
|
|
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
|
|
|
|
|
@@ -219,7 +219,7 @@ GAWK_EXT_TESTS = \
|
|
|
|
|
ARRAYDEBUG_TESTS = arrdbg
|
|
|
|
|
EXTRA_TESTS = inftest regtest ignrcas3
|
|
|
|
|
INET_TESTS = inetdayu inetdayt inetechu inetecht
|
|
|
|
|
-MACHINE_TESTS = double1 double2 intformat
|
|
|
|
|
+MACHINE_TESTS = double1 double2 inf-nan-torture intformat
|
|
|
|
|
LOCALE_CHARSET_TESTS = \
|
|
|
|
|
asort asorti backbigs1 backsmalls1 backsmalls2 \
|
|
|
|
|
fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \
|
|
|
|
|
@@ -361,10 +361,10 @@ check: msg \
|
|
|
|
|
basic-msg-start basic basic-msg-end \
|
|
|
|
|
unix-msg-start unix-tests unix-msg-end \
|
|
|
|
|
extend-msg-start gawk-extensions arraydebug-tests extend-msg-end \
|
|
|
|
|
- machine-msg-start machine-tests machine-msg-end \
|
|
|
|
|
charset-tests-all \
|
|
|
|
|
shlib-msg-start shlib-tests shlib-msg-end \
|
|
|
|
|
- mpfr-msg-start mpfr-tests mpfr-msg-end
|
|
|
|
|
+ mpfr-msg-start mpfr-tests mpfr-msg-end \
|
|
|
|
|
+ machine-msg-start machine-tests machine-msg-end
|
|
|
|
|
@-$(MAKE) pass-fail || { $(MAKE) diffout; exit 1; }
|
|
|
|
|
|
|
|
|
|
basic: $(BASIC_TESTS)
|
|
|
|
|
@@ -451,7 +451,9 @@ extend-msg-end:
|
|
|
|
|
@-echo "======== Done with gawk extension tests ========"
|
|
|
|
|
|
|
|
|
|
machine-msg-start:
|
|
|
|
|
- @-echo "======== Starting machine-specific tests ========"
|
|
|
|
|
+ @echo "======== Starting machine-specific tests ========"
|
|
|
|
|
+ @-echo "If any of these tests fail, don't worry too much."
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
machine-msg-end:
|
|
|
|
|
@-echo "======== Done with machine-specific tests ========"
|
|
|
|
|
@@ -2899,12 +2901,6 @@ indirectcall2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
-inf-nan-torture:
|
|
|
|
|
- @echo $@ $(ZOS_FAIL)
|
|
|
|
|
- @echo Expect $@ to fail with MinGW.
|
|
|
|
|
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
-
|
|
|
|
|
intarray:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@@ -3400,6 +3396,12 @@ double2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(TESTOUTCMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
+inf-nan-torture:
|
|
|
|
|
+ @echo $@ $(ZOS_FAIL)
|
|
|
|
|
+ @echo Expect $@ to fail with MinGW.
|
|
|
|
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
+
|
|
|
|
|
intformat:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
|
|
|
|
index 547760b..3070cec 100644
|
|
|
|
|
--- a/test/Makefile.am
|
|
|
|
|
+++ b/test/Makefile.am
|
|
|
|
|
@@ -1445,7 +1445,7 @@ GAWK_EXT_TESTS = \
|
|
|
|
|
gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
|
|
|
|
|
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
|
|
|
|
|
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
|
|
|
|
|
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
|
|
|
|
|
+ indirectcall indirectcall2 intarray iolint \
|
|
|
|
|
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
|
|
|
|
|
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
|
|
|
|
|
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
|
|
|
|
|
@@ -1471,7 +1471,7 @@ EXTRA_TESTS = inftest regtest ignrcas3
|
|
|
|
|
|
|
|
|
|
INET_TESTS = inetdayu inetdayt inetechu inetecht
|
|
|
|
|
|
|
|
|
|
-MACHINE_TESTS = double1 double2 intformat
|
|
|
|
|
+MACHINE_TESTS = double1 double2 inf-nan-torture intformat
|
|
|
|
|
|
|
|
|
|
LOCALE_CHARSET_TESTS = \
|
|
|
|
|
asort asorti backbigs1 backsmalls1 backsmalls2 \
|
|
|
|
|
@@ -1625,10 +1625,10 @@ check: msg \
|
|
|
|
|
basic-msg-start basic basic-msg-end \
|
|
|
|
|
unix-msg-start unix-tests unix-msg-end \
|
|
|
|
|
extend-msg-start gawk-extensions arraydebug-tests extend-msg-end \
|
|
|
|
|
- machine-msg-start machine-tests machine-msg-end \
|
|
|
|
|
charset-tests-all \
|
|
|
|
|
shlib-msg-start shlib-tests shlib-msg-end \
|
|
|
|
|
- mpfr-msg-start mpfr-tests mpfr-msg-end
|
|
|
|
|
+ mpfr-msg-start mpfr-tests mpfr-msg-end \
|
|
|
|
|
+ machine-msg-start machine-tests machine-msg-end
|
|
|
|
|
@$(MAKE) pass-fail || { $(MAKE) diffout; exit 1; }
|
|
|
|
|
|
|
|
|
|
basic: $(BASIC_TESTS)
|
|
|
|
|
@@ -1716,6 +1716,7 @@ extend-msg-end:
|
|
|
|
|
|
|
|
|
|
machine-msg-start:
|
|
|
|
|
@echo "======== Starting machine-specific tests ========"
|
|
|
|
|
+ @echo "If any of these tests fail, don't worry too much."
|
|
|
|
|
|
|
|
|
|
machine-msg-end:
|
|
|
|
|
@echo "======== Done with machine-specific tests ========"
|
|
|
|
|
diff --git a/test/Makefile.in b/test/Makefile.in
|
|
|
|
|
index b265eab..accb0b3 100644
|
|
|
|
|
--- a/test/Makefile.in
|
|
|
|
|
+++ b/test/Makefile.in
|
|
|
|
|
@@ -1711,7 +1711,7 @@ GAWK_EXT_TESTS = \
|
|
|
|
|
gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
|
|
|
|
|
ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
|
|
|
|
|
incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
|
|
|
|
|
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
|
|
|
|
|
+ indirectcall indirectcall2 intarray iolint \
|
|
|
|
|
isarrayunset lint lintexp lintindex lintint lintlength lintplus \
|
|
|
|
|
lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
|
|
|
|
|
mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
|
|
|
|
|
@@ -1734,7 +1734,7 @@ GAWK_EXT_TESTS = \
|
|
|
|
|
ARRAYDEBUG_TESTS = arrdbg
|
|
|
|
|
EXTRA_TESTS = inftest regtest ignrcas3
|
|
|
|
|
INET_TESTS = inetdayu inetdayt inetechu inetecht
|
|
|
|
|
-MACHINE_TESTS = double1 double2 intformat
|
|
|
|
|
+MACHINE_TESTS = double1 double2 inf-nan-torture intformat
|
|
|
|
|
LOCALE_CHARSET_TESTS = \
|
|
|
|
|
asort asorti backbigs1 backsmalls1 backsmalls2 \
|
|
|
|
|
fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \
|
|
|
|
|
@@ -2080,10 +2080,10 @@ check: msg \
|
|
|
|
|
basic-msg-start basic basic-msg-end \
|
|
|
|
|
unix-msg-start unix-tests unix-msg-end \
|
|
|
|
|
extend-msg-start gawk-extensions arraydebug-tests extend-msg-end \
|
|
|
|
|
- machine-msg-start machine-tests machine-msg-end \
|
|
|
|
|
charset-tests-all \
|
|
|
|
|
shlib-msg-start shlib-tests shlib-msg-end \
|
|
|
|
|
- mpfr-msg-start mpfr-tests mpfr-msg-end
|
|
|
|
|
+ mpfr-msg-start mpfr-tests mpfr-msg-end \
|
|
|
|
|
+ machine-msg-start machine-tests machine-msg-end
|
|
|
|
|
@$(MAKE) pass-fail || { $(MAKE) diffout; exit 1; }
|
|
|
|
|
|
|
|
|
|
basic: $(BASIC_TESTS)
|
|
|
|
|
@@ -2171,6 +2171,7 @@ extend-msg-end:
|
|
|
|
|
|
|
|
|
|
machine-msg-start:
|
|
|
|
|
@echo "======== Starting machine-specific tests ========"
|
|
|
|
|
+ @echo "If any of these tests fail, don't worry too much."
|
|
|
|
|
|
|
|
|
|
machine-msg-end:
|
|
|
|
|
@echo "======== Done with machine-specific tests ========"
|
|
|
|
|
@@ -4578,11 +4579,6 @@ indirectcall2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
-inf-nan-torture:
|
|
|
|
|
- @echo $@ $(ZOS_FAIL)
|
|
|
|
|
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
-
|
|
|
|
|
intarray:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@@ -5072,6 +5068,11 @@ double2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
+inf-nan-torture:
|
|
|
|
|
+ @echo $@ $(ZOS_FAIL)
|
|
|
|
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
+
|
|
|
|
|
intformat:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
diff --git a/test/Maketests b/test/Maketests
|
|
|
|
|
index eb5e4bb..027b876 100644
|
|
|
|
|
--- a/test/Maketests
|
|
|
|
|
+++ b/test/Maketests
|
|
|
|
|
@@ -1643,11 +1643,6 @@ indirectcall2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
-inf-nan-torture:
|
|
|
|
|
- @echo $@ $(ZOS_FAIL)
|
|
|
|
|
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
-
|
|
|
|
|
intarray:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --non-decimal-data >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@@ -2137,6 +2132,11 @@ double2:
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
|
|
|
|
|
+inf-nan-torture:
|
|
|
|
|
+ @echo $@ $(ZOS_FAIL)
|
|
|
|
|
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
|
|
|
|
|
+
|
|
|
|
|
intformat:
|
|
|
|
|
@echo $@
|
|
|
|
|
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
|
|
|
|
|
--
|
|
|
|
|
2.40.0
|
|
|
|
|
|