On Minix 3.3, I see these test failures:

FAIL: test-fenv-except-state-1
==============================

../../gltests/test-fenv-except-state-1.c:62: assertion 'fetestexcept 
(FE_OVERFLOW) == FE_OVERFLOW' failed
FAIL test-fenv-except-state-1 (exit status: 134)

FAIL: test-fenv-except-tracking-4
=================================

../../gltests/test-fenv-except-tracking-4.c:45: assertion 'fetestexcept 
(FE_ALL_EXCEPT) == FE_INVALID' failed
FAIL test-fenv-except-tracking-4 (exit status: 134)

FAIL: test-fenv-except-trapping-2.sh
====================================

...
Failed (got no trap): ./test-fenv-except-trapping-2 4 p f
Failed (got no trap): ./test-fenv-except-trapping-2 4 p d
Failed (got no trap): ./test-fenv-except-trapping-2 4 p l
Failed (got no trap): ./test-fenv-except-trapping-2 4 q f
Failed (got no trap): ./test-fenv-except-trapping-2 4 q d
Failed (got no trap): ./test-fenv-except-trapping-2 4 q l
Failed (got no trap): ./test-fenv-except-trapping-2 4 r f
Failed (got no trap): ./test-fenv-except-trapping-2 4 r d
Failed (got no trap): ./test-fenv-except-trapping-2 4 r l
...

The latter failure is easy to work around. Then, regarding the first two:

* Forcing
    REPLACE_FETESTEXCEPT=1
    REPLACE_FECLEAREXCEPT=1
    REPLACE_FERAISEEXCEPT=1
  the tests succeed.

* Forcing only
    REPLACE_FETESTEXCEPT=1
    REPLACE_FECLEAREXCEPT=1
  the tests still succeed.

* Forcing only
    REPLACE_FETESTEXCEPT=1
  the test failures are:

    ../../gltests/test-fenv-except-state-1.c:69: assertion 'fetestexcept 
(FE_INVALID) == 0' failed
    FAIL test-fenv-except-state-1 (exit status: 134)

    ../../gltests/test-fenv-except-tracking-4.c:45: assertion 'fetestexcept 
(FE_ALL_EXCEPT) == FE_INVALID' failed
    FAIL test-fenv-except-tracking-4 (exit status: 134)

    ../../gltests/test-fenv-except-tracking-1.c:50: assertion 'fetestexcept 
(FE_ALL_EXCEPT) == 0' failed
    FAIL test-fenv-except-tracking-1 (exit status: 134)

  which clearly indicates a problem with the feclearexcept() function.

* Forcing only
    REPLACE_FECLEAREXCEPT=1
  the test failures are:

    ../../gltests/test-fenv-except-state-1.c:62: assertion 'fetestexcept 
(FE_OVERFLOW) == FE_OVERFLOW' failed
    FAIL test-fenv-except-state-1 (exit status: 134)

    ../../gltests/test-fenv-except-tracking-4.c:45: assertion 'fetestexcept 
(FE_ALL_EXCEPT) == FE_INVALID' failed
    FAIL test-fenv-except-tracking-4 (exit status: 134)

So, clearly both functions need to be overridden.


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

        fenv-exceptions-trapping: Avoid test failure on Minix.
        * tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests also on
        Minix.

        fenv-exceptions-tracking-c99: Fix test failures on Minix.
        * m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
        Minix, set REPLACE_FECLEAREXCEPT and REPLACE_FETESTEXCEPT to 1.
        * doc/posix-functions/feclearexcept.texi: Mention the Minix bug.
        * doc/posix-functions/fetestexcept.texi: Likewise.


>From 35bac6a74c9ded7bdf7c4e0ffd07db702c1a2a1d Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 5 Nov 2023 23:25:08 +0100
Subject: [PATCH 1/2] fenv-exceptions-tracking-c99: Fix test failures on Minix.

* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
Minix, set REPLACE_FECLEAREXCEPT and REPLACE_FETESTEXCEPT to 1.
* doc/posix-functions/feclearexcept.texi: Mention the Minix bug.
* doc/posix-functions/fetestexcept.texi: Likewise.
---
 ChangeLog                              | 8 ++++++++
 doc/posix-functions/feclearexcept.texi | 3 +++
 doc/posix-functions/fetestexcept.texi  | 3 +++
 m4/fenv-exceptions-tracking.m4         | 8 +++++++-
 4 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 0648ef3720..e4567afb8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-05  Bruno Haible  <br...@clisp.org>
+
+	fenv-exceptions-tracking-c99: Fix test failures on Minix.
+	* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
+	Minix, set REPLACE_FECLEAREXCEPT and REPLACE_FETESTEXCEPT to 1.
+	* doc/posix-functions/feclearexcept.texi: Mention the Minix bug.
+	* doc/posix-functions/fetestexcept.texi: Likewise.
+
 2023-11-05  Bruno Haible  <br...@clisp.org>
 
 	fenv-exceptions-trapping: Avoid test failure on Haiku/i386.
diff --git a/doc/posix-functions/feclearexcept.texi b/doc/posix-functions/feclearexcept.texi
index 8b218804bd..4df9178c30 100644
--- a/doc/posix-functions/feclearexcept.texi
+++ b/doc/posix-functions/feclearexcept.texi
@@ -11,6 +11,9 @@
 @item
 This function is missing on some platforms:
 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.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/doc/posix-functions/fetestexcept.texi b/doc/posix-functions/fetestexcept.texi
index 7e9b8e3327..0073316465 100644
--- a/doc/posix-functions/fetestexcept.texi
+++ b/doc/posix-functions/fetestexcept.texi
@@ -15,6 +15,9 @@
 This function clears the floating-point exception trap bits on some platforms:
 @c It uses an 'fnstenv' instruction without subsequent 'fldenv' or 'fldcw'.
 NetBSD 9.3/x86_64.
+@item
+This function is broken on some platforms:
+Minix 3.3/i386.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/fenv-exceptions-tracking.m4 b/m4/fenv-exceptions-tracking.m4
index 1aa378f971..d5c384c9cb 100644
--- a/m4/fenv-exceptions-tracking.m4
+++ b/m4/fenv-exceptions-tracking.m4
@@ -1,4 +1,4 @@
-# fenv-exceptions-tracking.m4 serial 2
+# fenv-exceptions-tracking.m4 serial 3
 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,12 @@ AC_DEFUN_ONCE([gl_FENV_EXCEPTIONS_TRACKING]
         dnl 'fnstenv' instruction without subsequent 'fldenv' or 'fldcw').
         REPLACE_FETESTEXCEPT=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.
+        REPLACE_FECLEAREXCEPT=1
+        REPLACE_FETESTEXCEPT=1
+        ;;
     esac
     if test $REPLACE_FECLEAREXCEPT = 1 \
        && test $REPLACE_FETESTEXCEPT = 1 \
-- 
2.34.1

>From 478697d6a7a8e36a149c34e20427f1a8aded7fd4 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 5 Nov 2023 22:47:59 +0100
Subject: [PATCH 2/2] fenv-exceptions-trapping: Avoid test failure on Minix.

* tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests also on
Minix.
---
 ChangeLog                           | 4 ++++
 tests/test-fenv-except-trapping-2.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index e4567afb8a..e8f7086eb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-11-05  Bruno Haible  <br...@clisp.org>
 
+	fenv-exceptions-trapping: Avoid test failure on Minix.
+	* tests/test-fenv-except-trapping-2.c (main): Skip the '4' tests also on
+	Minix.
+
 	fenv-exceptions-tracking-c99: Fix test failures on Minix.
 	* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
 	Minix, set REPLACE_FECLEAREXCEPT and REPLACE_FETESTEXCEPT to 1.
diff --git a/tests/test-fenv-except-trapping-2.c b/tests/test-fenv-except-trapping-2.c
index 41da5d5b28..21d3548401 100644
--- a/tests/test-fenv-except-trapping-2.c
+++ b/tests/test-fenv-except-trapping-2.c
@@ -436,6 +436,7 @@ main (int argc, char *argv[])
            FreeBSD/i386, FreeBSD/x86_64,
            NetBSD/i386, NetBSD/x86_64,
            OpenBSD/i386, OpenBSD/x86_64,
+           Minix/i386,
            AIX/powerpc,
            Solaris/i386, Solaris/x86_64,
            Cygwin/x86_64,
@@ -459,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 __minix && (defined __i386 || defined _M_IX86)) \
           || (defined _AIX && defined __powerpc__) \
           || (defined __sun && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \
           || (defined __CYGWIN__ && (defined __x86_64__ || defined _M_X64)) \
-- 
2.34.1

Reply via email to