On OpenBSD/mips64, I see a couple of test failures of the fenv-* modules:

FAIL: test-fenv-env-1
FAIL: test-fenv-env-2
FAIL: test-fenv-env-3
FAIL: test-fenv-env-4
FAIL: test-fenv-except-state-2
FAIL: test-fenv-except-tracking-2.sh
FAIL: test-fenv-except-trapping-2.sh
FAIL: test-fenv-round
FAIL: test-nan-2
FAIL: test-snan-1

This set of patches fixes or silences them.


2023-11-06  Bruno Haible  <br...@clisp.org>

        snan: Avoid test failures on OpenBSD/mips64.
        * tests/test-snan-1.c (main): Skip the 'long double' test on
        OpenBSD/mips64.
        * tests/test-snan-2.c (main): Likewise.

        fenv-*: Avoid test failures on OpenBSD/mips64.
        * tests/test-fenv-round.c (test_towardzero, test_upward, test_downward):
        Skip the 'long double' tests on OpenBSD/mips64.
        * tests/test-fenv-except-tracking-2.c (main): On OpenBSD/mips64, skip
        the 'long double' test.
        * tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests and the
        'long double' tests also on OpenBSD/mips64.
        * doc/posix-functions/fesetround.texi: Mention OpenBSD/mips64 here too.

        fenv-exceptions-tracking-c99: Fix test failures on OpenBSD/mips64.
        * m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
        OpenBSD/mips, set REPLACE_FECLEAREXCEPT to 1.
        * doc/posix-functions/feclearexcept.texi: Mention the OpenBSD/mips64
        bug.
        * m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): No need to set
        gl_cv_func_fesetexceptflag_works1 to 'no' on OpenBSD/mips.

>From 80028c70694e049f7dff9aec6888daf86d556106 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Tue, 7 Nov 2023 02:04:47 +0100
Subject: [PATCH 1/3] fenv-exceptions-tracking-c99: Fix test failures on
 OpenBSD/mips64.

* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
OpenBSD/mips, set REPLACE_FECLEAREXCEPT to 1.
* doc/posix-functions/feclearexcept.texi: Mention the OpenBSD/mips64
bug.
* m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): No need to set
gl_cv_func_fesetexceptflag_works1 to 'no' on OpenBSD/mips.
---
 ChangeLog                              | 10 ++++++++++
 doc/posix-functions/feclearexcept.texi |  2 +-
 m4/fenv-exceptions-state.m4            | 14 ++++++++++++--
 m4/fenv-exceptions-tracking.m4         |  7 ++++++-
 4 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1806fe19de..7fd78a2bd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-11-06  Bruno Haible  <br...@clisp.org>
+
+	fenv-exceptions-tracking-c99: Fix test failures on OpenBSD/mips64.
+	* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
+	OpenBSD/mips, set REPLACE_FECLEAREXCEPT to 1.
+	* doc/posix-functions/feclearexcept.texi: Mention the OpenBSD/mips64
+	bug.
+	* m4/fenv-exceptions-state.m4 (gl_FENV_EXCEPTIONS_STATE): No need to set
+	gl_cv_func_fesetexceptflag_works1 to 'no' on OpenBSD/mips.
+
 2023-11-06  Bruno Haible  <br...@clisp.org>
 
 	nan: Defeat clang's incorrect -O2 optimization on mips64.
diff --git a/doc/posix-functions/feclearexcept.texi b/doc/posix-functions/feclearexcept.texi
index 4df9178c30..a553371abe 100644
--- a/doc/posix-functions/feclearexcept.texi
+++ b/doc/posix-functions/feclearexcept.texi
@@ -13,7 +13,7 @@
 FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, IRIX 6.5, Solaris 9, Cygwin 1.7.7, MSVC 9, Android 4.4.
 @item
 This function is broken on some platforms:
-Minix 3.3/i386.
+OpenBSD 7.4/mips64, Minix 3.3/i386.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/fenv-exceptions-state.m4 b/m4/fenv-exceptions-state.m4
index 3cd09edd11..239adedba0 100644
--- a/m4/fenv-exceptions-state.m4
+++ b/m4/fenv-exceptions-state.m4
@@ -1,4 +1,4 @@
-# fenv-exceptions-state.m4 serial 1
+# fenv-exceptions-state.m4 serial 2
 dnl Copyright (C) 2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -89,7 +89,17 @@ AC_DEFUN([gl_FENV_EXCEPTIONS_STATE]
                 ]])
              ],
              [gl_cv_func_fesetexceptflag_works1=yes],
-             [gl_cv_func_fesetexceptflag_works1=no],
+             [dnl On OpenBSD 7.4/mips64 this test fails because feclearexcept
+              dnl is buggy, not because of fesetexceptflag.
+              case "$host" in
+                mips*-*-openbsd*)
+                  gl_cv_func_fesetexceptflag_works1="guessing yes"
+                  ;;
+                *)
+                  gl_cv_func_fesetexceptflag_works1=no
+                  ;;
+              esac
+             ],
              [case "$host_os" in
                 # Guess yes or no on glibc systems, depending on CPU.
                 *-gnu*)
diff --git a/m4/fenv-exceptions-tracking.m4 b/m4/fenv-exceptions-tracking.m4
index d5c384c9cb..4861cdc0e1 100644
--- a/m4/fenv-exceptions-tracking.m4
+++ b/m4/fenv-exceptions-tracking.m4
@@ -1,4 +1,4 @@
-# fenv-exceptions-tracking.m4 serial 3
+# fenv-exceptions-tracking.m4 serial 4
 dnl Copyright (C) 2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -118,6 +118,11 @@ AC_DEFUN_ONCE([gl_FENV_EXCEPTIONS_TRACKING]
         dnl 'fnstenv' instruction without subsequent 'fldenv' or 'fldcw').
         REPLACE_FETESTEXCEPT=1
         ;;
+      mips*-*-openbsd*)
+        dnl On OpenBSD 7.4/mips64, the feclearexcept function does not work:
+        dnl it misses to clear the "cause bits".
+        REPLACE_FECLEAREXCEPT=1
+        ;;
       *86*-*-minix*)
         dnl On Minix 3.3, both the feclearexcept and fetestexcept functions
         dnl need to be overridden; otherwise we get unit test failures.
-- 
2.34.1

>From 0c60267ad3c90d1c7b35a678171b7b259f16ae1e Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Tue, 7 Nov 2023 02:04:59 +0100
Subject: [PATCH 2/3] fenv-*: Avoid test failures on OpenBSD/mips64.

* tests/test-fenv-round.c (test_towardzero, test_upward, test_downward):
Skip the 'long double' tests on OpenBSD/mips64.
* tests/test-fenv-except-tracking-2.c (main): On OpenBSD/mips64, skip
the 'long double' test.
* tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests and the
'long double' tests also on OpenBSD/mips64.
* doc/posix-functions/fesetround.texi: Mention OpenBSD/mips64 here too.
---
 ChangeLog                           | 9 +++++++++
 doc/posix-functions/fesetround.texi | 2 +-
 tests/test-fenv-except-tracking-2.c | 4 +++-
 tests/test-fenv-except-trapping-2.c | 7 +++++--
 tests/test-fenv-round.c             | 6 +++---
 5 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7fd78a2bd8..ac84b28734 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2023-11-06  Bruno Haible  <br...@clisp.org>
 
+	fenv-*: Avoid test failures on OpenBSD/mips64.
+	* tests/test-fenv-round.c (test_towardzero, test_upward, test_downward):
+	Skip the 'long double' tests on OpenBSD/mips64.
+	* tests/test-fenv-except-tracking-2.c (main): On OpenBSD/mips64, skip
+	the 'long double' test.
+	* tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests and the
+	'long double' tests also on OpenBSD/mips64.
+	* doc/posix-functions/fesetround.texi: Mention OpenBSD/mips64 here too.
+
 	fenv-exceptions-tracking-c99: Fix test failures on OpenBSD/mips64.
 	* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
 	OpenBSD/mips, set REPLACE_FECLEAREXCEPT to 1.
diff --git a/doc/posix-functions/fesetround.texi b/doc/posix-functions/fesetround.texi
index 73d6c034fa..bb06c4192a 100644
--- a/doc/posix-functions/fesetround.texi
+++ b/doc/posix-functions/fesetround.texi
@@ -20,5 +20,5 @@
 @itemize
 @item
 The rounding mode has no effect on @code{long double} operations on some platforms:
-FreeBSD/arm64, NetBSD/sparc64.
+FreeBSD/arm64, NetBSD/sparc64, OpenBSD/mips64.
 @end itemize
diff --git a/tests/test-fenv-except-tracking-2.c b/tests/test-fenv-except-tracking-2.c
index 9844166d81..6687a79b2b 100644
--- a/tests/test-fenv-except-tracking-2.c
+++ b/tests/test-fenv-except-tracking-2.c
@@ -67,10 +67,12 @@ main (int argc, char *argv[])
         /* This test does not work on Linux/loongarch64 with glibc 2.37.
            Likewise on Linux/alpha with glibc 2.7 on Linux 2.6.26.
            Likewise on FreeBSD 12.2/sparc and NetBSD 8.0/sparc.
+           Likewise on OpenBSD 7.4/mips64.
            Cause unknown.  */
         #if !((__GLIBC__ >= 2 && defined __loongarch__) \
               || ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 36) && defined __alpha) \
-              || ((defined __FreeBSD__ || defined __NetBSD__) && defined __sparc))
+              || ((defined __FreeBSD__ || defined __NetBSD__) && defined __sparc) \
+              || (defined __OpenBSD__ && defined __mips64))
         {
           volatile long double a, b;
           _GL_UNUSED volatile long double c;
diff --git a/tests/test-fenv-except-trapping-2.c b/tests/test-fenv-except-trapping-2.c
index 21d3548401..8c3c902437 100644
--- a/tests/test-fenv-except-trapping-2.c
+++ b/tests/test-fenv-except-trapping-2.c
@@ -435,7 +435,7 @@ main (int argc, char *argv[])
            macOS/i386, macOS/x86_64, macOS/arm64,
            FreeBSD/i386, FreeBSD/x86_64,
            NetBSD/i386, NetBSD/x86_64,
-           OpenBSD/i386, OpenBSD/x86_64,
+           OpenBSD/i386, OpenBSD/x86_64, OpenBSD/mips64,
            Minix/i386,
            AIX/powerpc,
            Solaris/i386, Solaris/x86_64,
@@ -460,6 +460,7 @@ main (int argc, char *argv[])
           || (defined MUSL_LIBC && ((defined __i386 || defined _M_IX86) || defined __powerpc__)) \
           || ((defined __APPLE__ && defined __MACH__) && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86) || defined __aarch64__)) \
           || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
+          || (defined __OpenBSD__ && defined __mips64) \
           || (defined __minix && (defined __i386 || defined _M_IX86)) \
           || (defined _AIX && defined __powerpc__) \
           || (defined __sun && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
@@ -480,10 +481,12 @@ main (int argc, char *argv[])
       /* The 'l' tests do not work on Linux/loongarch64 with glibc 2.37.
          Likewise on Linux/alpha with glibc 2.7 on Linux 2.6.26.
          Likewise on FreeBSD 12.2/sparc and NetBSD 8.0/sparc.
+         Likewise on OpenBSD 7.4/mips64.
          Cause unknown.  */
       #if (__GLIBC__ >= 2 && defined __loongarch__) \
           || ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 36) && defined __alpha) \
-          || ((defined __FreeBSD__ || defined __NetBSD__) && defined __sparc)
+          || ((defined __FreeBSD__ || defined __NetBSD__) && defined __sparc) \
+          || (defined __OpenBSD__ && defined __mips64)
       known_failure |= (type_arg[0] == 'l');
       #endif
       if (known_failure)
diff --git a/tests/test-fenv-round.c b/tests/test-fenv-round.c
index b697fb1301..637b204bfd 100644
--- a/tests/test-fenv-round.c
+++ b/tests/test-fenv-round.c
@@ -45,7 +45,7 @@ test_towardzero ()
     a = -1; b = 3; q = a / b; p = b * q;
     ASSERT (p > a);
   }
-#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */))
+#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */) || (defined __OpenBSD__ && defined __mips64))
   {
     long double volatile a, b, q, p;
 
@@ -80,7 +80,7 @@ test_upward ()
     a = -1; b = 3; q = a / b; p = b * q;
     ASSERT (p > a);
   }
-#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */))
+#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */) || (defined __OpenBSD__ && defined __mips64))
   {
     long double volatile a, b, q, p;
 
@@ -115,7 +115,7 @@ test_downward ()
     a = -1; b = 3; q = a / b; p = b * q;
     ASSERT (p < a);
   }
-#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */))
+#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */) || (defined __OpenBSD__ && defined __mips64))
   {
     long double volatile a, b, q, p;
 
-- 
2.34.1

>From b341bddfe4e1781d78f60fc6f73b454b39ae17ca Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Tue, 7 Nov 2023 02:05:05 +0100
Subject: [PATCH 3/3] snan: Avoid test failures on OpenBSD/mips64.

* tests/test-snan-1.c (main): Skip the 'long double' test on
OpenBSD/mips64.
* tests/test-snan-2.c (main): Likewise.
---
 ChangeLog           | 5 +++++
 tests/test-snan-1.c | 4 ++--
 tests/test-snan-2.c | 4 ++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ac84b28734..46a5974795 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-11-06  Bruno Haible  <br...@clisp.org>
 
+	snan: Avoid test failures on OpenBSD/mips64.
+	* tests/test-snan-1.c (main): Skip the 'long double' test on
+	OpenBSD/mips64.
+	* tests/test-snan-2.c (main): Likewise.
+
 	fenv-*: Avoid test failures on OpenBSD/mips64.
 	* tests/test-fenv-round.c (test_towardzero, test_upward, test_downward):
 	Skip the 'long double' tests on OpenBSD/mips64.
diff --git a/tests/test-snan-1.c b/tests/test-snan-1.c
index 3b1e0e9427..74d980f317 100644
--- a/tests/test-snan-1.c
+++ b/tests/test-snan-1.c
@@ -83,14 +83,14 @@ main ()
   #endif
   /* This test does not work on eglibc 2.13/mips64
      (bug in libc function __addtf3).
-     This test does not work on FreeBSD/arm64
+     This test does not work on FreeBSD/arm64 and OpenBSD/mips64
      (bug in libc function __addtf3).
      This test does not work on FreeBSD/sparc64 and NetBSD/sparc64
      (bug in libc function _Qp_add).
      This test does not work on MSVC/i386, because of the general IA-32
      problem (see above) and 'long double' == 'double'.  */
   #if !((((__GLIBC__ == 2 && __GLIBC_MINOR__ < 19 && defined __mips64) \
-          || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __sparc__))) \
+          || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc__))) \
          && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE) \
         || ((defined __i386 || defined _M_IX86) && HAVE_SAME_LONG_DOUBLE_AS_DOUBLE))
   {
diff --git a/tests/test-snan-2.c b/tests/test-snan-2.c
index 0a722a05ac..817540c74c 100644
--- a/tests/test-snan-2.c
+++ b/tests/test-snan-2.c
@@ -108,7 +108,7 @@ main (int argc, char *argv[])
            Cause unknown.
            This test does not work on eglibc 2.13/mips64
            (bug in libc function __addtf3).
-           This test does not work on FreeBSD/arm64
+           This test does not work on FreeBSD/arm64 and OpenBSD/mips64
            (bug in libc function __addtf3).
            This test does not work on FreeBSD/sparc64 and NetBSD/sparc64
            (bug in libc function _Qp_add).
@@ -118,7 +118,7 @@ main (int argc, char *argv[])
         #if !((__GLIBC__ == 2 && __GLIBC_MINOR__ < 36 && defined __alpha__) \
               || (__GLIBC__ >= 2 && defined __loongarch__) \
               || (((__GLIBC__ == 2 && __GLIBC_MINOR__ < 19 && defined __mips64) \
-                   || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __sparc__))) \
+                   || ((defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__) && (defined __aarch64__ || defined __mips64__ || defined __sparc__))) \
                   && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE) \
               || (defined __CYGWIN__ && defined __i386) \
               || (((defined __i386 || defined _M_IX86) \
-- 
2.34.1

Reply via email to