From: Bruno Haible Date: Sat, 4 Nov 2023 15:54:43 +0000 (+0100) Subject: fenv-exceptions-trapping: Fix for powerpc* platforms. X-Git-Tag: v1.0~651 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=2f7cf8a48cd2d41d78d5ef5070508269cb7f2555;p=gnulib.git 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/ChangeLog b/ChangeLog index 66e5ce0da9..55a85289f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-11-04 Bruno Haible + + 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. + 2023-11-04 Bruno Haible fenv-exceptions-state-c99: Fix compilation error on FreeBSD. 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.