]> Savannah Git Hosting - gnulib.git/commitdiff
fenv-exceptions-tracking-c99: Work around a NetBSD/x86_64 bug.
authorBruno Haible <bruno@clisp.org>
Sat, 4 Nov 2023 13:31:37 +0000 (14:31 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Nov 2023 13:33:54 +0000 (14:33 +0100)
* m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
NetBSD/x86_64, set REPLACE_FETESTEXCEPT to 1.
* doc/posix-functions/fetestexcept.texi: Document the NetBSD bug.

ChangeLog
doc/posix-functions/fetestexcept.texi
m4/fenv-exceptions-tracking.m4

index 355ad2396d2faf8d552fe7ae6f4951bb130f6782..b63bf1abc3d8ad4126c8e20153c0630925b8a3ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-11-04  Bruno Haible  <bruno@clisp.org>
+
+       fenv-exceptions-tracking-c99: Work around a NetBSD/x86_64 bug.
+       * m4/fenv-exceptions-tracking.m4 (gl_FENV_EXCEPTIONS_TRACKING): On
+       NetBSD/x86_64, set REPLACE_FETESTEXCEPT to 1.
+       * doc/posix-functions/fetestexcept.texi: Document the NetBSD bug.
+
 2023-11-04  Bruno Haible  <bruno@clisp.org>
 
        fenv-rounding: Avoid a test failure on NetBSD/sparc64.
index b8eba903bedae8dc9051901d073efc9e7bfdcbbe..7e9b8e33277d3e97cfce1252f2ff97f4949b0e0d 100644 (file)
@@ -11,6 +11,10 @@ Portability problems fixed by Gnulib:
 @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 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.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index a7ffa80784e27348334f59ddceefb7f4e76f2f7d..1aa378f971dc7701a56dfd648665f07f27df5c74 100644 (file)
@@ -1,4 +1,4 @@
-# fenv-exceptions-tracking.m4 serial 1
+# fenv-exceptions-tracking.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,
@@ -20,6 +20,8 @@ AC_DEFUN_ONCE([gl_FENV_EXCEPTIONS_TRACKING],
     dnl On musl libc, on those CPUs where fenv-except-tracking-raise.c
     dnl uses the "generic" approach, feraiseexcept does not trigger traps
     dnl because it merely manipulates flags in the control register.
+    dnl On NetBSD 9.3/x86_64, fetestexcept clears the exception trap bits,
+    dnl causing the fenv-environment tests to fail.
     case "$host" in
       arm*-*-linux*)
         AC_CACHE_CHECK([whether feraiseexcept works],
@@ -110,6 +112,12 @@ AC_DEFUN_ONCE([gl_FENV_EXCEPTIONS_TRACKING],
           *) REPLACE_FERAISEEXCEPT=1 ;;
         esac
         ;;
+      x86_64-*-netbsd*)
+        dnl On NetBSD 9.3/x86_64, fetestexcept is broken: it clears the
+        dnl floating-point exception trap bits (because it uses an
+        dnl 'fnstenv' instruction without subsequent 'fldenv' or 'fldcw').
+        REPLACE_FETESTEXCEPT=1
+        ;;
     esac
     if test $REPLACE_FECLEAREXCEPT = 1 \
        && test $REPLACE_FETESTEXCEPT = 1 \