I had made a mistake in the override code for powerpc. This patch fixes it.


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

        fenv-exceptions-trapping: Fix for powerpc* platforms.
        * lib/fenv-except-trapping.c (feenableexcept, fedisableexcept)
        [powerpc]: Use the correct bit mask for the trap bits.
        * tests/test-fenv-except-trapping-2.c (main): Reenable the '9' tests on
        powerpc platforms.

diff --git a/lib/fenv-except-trapping.c b/lib/fenv-except-trapping.c
index a86cbd2d39..554f8128de 100644
--- a/lib/fenv-except-trapping.c
+++ b/lib/fenv-except-trapping.c
@@ -505,7 +505,7 @@ feenableexcept (int exceptions)
 
   if (!(memenv.u == orig_memenv.u))
     {
-      if ((orig_memenv.u & 0x000000f7) == 0 && (memenv.u & 0x000000f7) != 0)
+      if ((orig_memenv.u & 0x000000f8) == 0 && (memenv.u & 0x000000f8) != 0)
         {
           /* Put the thread into precise trapping mode.  */
 #  if defined __linux__ || defined __NetBSD__
@@ -537,7 +537,7 @@ fedisableexcept (int exceptions)
     {
       _FPU_SETCW_AS_DOUBLE (memenv.f);
 
-      if ((orig_memenv.u & 0x000000f7) != 0 && (memenv.u & 0x000000f7) == 0)
+      if ((orig_memenv.u & 0x000000f8) != 0 && (memenv.u & 0x000000f8) == 0)
         {
           /* Put the thread into no-trapping mode.  */
 #  if defined __linux__ || defined __NetBSD__
diff --git a/tests/test-fenv-except-trapping-2.c 
b/tests/test-fenv-except-trapping-2.c
index 18f42b89c2..99a67d0969 100644
--- a/tests/test-fenv-except-trapping-2.c
+++ b/tests/test-fenv-except-trapping-2.c
@@ -448,10 +448,8 @@ main (int argc, char *argv[])
       #if defined __i386 || defined _M_IX86
       known_failure |= (operation_arg[0] == '7' || operation_arg[0] == '8');
       #endif
-      /* The '9' tests do not work on Linux/alpha, musl libc/powerpc64le,
-         AIX/powerpc.  */
-      #if (__GLIBC__ >= 2 && defined __alpha) \
-          || ((defined MUSL_LIBC || defined _AIX) && defined __powerpc__)
+      /* The '9' tests do not work on Linux/alpha.  */
+      #if (__GLIBC__ >= 2 && defined __alpha)
       known_failure |= (operation_arg[0] == '9');
       #endif
       /* The 'l' tests do not work on Linux/loongarch64 with glibc 2.37.




Reply via email to