From 6e9dcf80be5e744dd3149d933cbdcfdef6e8c50e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 5 Nov 2023 12:49:43 +0100 Subject: [PATCH] fenv-exceptions-trapping: Avoid test failure on older systems. * tests/test-fenv-except-trapping-2.c (main): Skip the test also on x86 systems with gcc < 8. --- ChangeLog | 6 +++++ tests/test-fenv-except-trapping-2.c | 37 ++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55a85289f5..766cbfb5f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2023-11-05 Bruno Haible + + fenv-exceptions-trapping: Avoid test failure on older systems. + * tests/test-fenv-except-trapping-2.c (main): Skip the test also on x86 + systems with gcc < 8. + 2023-11-04 Bruno Haible fenv-exceptions-trapping: Fix for powerpc* platforms. diff --git a/tests/test-fenv-except-trapping-2.c b/tests/test-fenv-except-trapping-2.c index 99a67d0969..e11a31da84 100644 --- a/tests/test-fenv-except-trapping-2.c +++ b/tests/test-fenv-except-trapping-2.c @@ -425,14 +425,35 @@ main (int argc, char *argv[]) /* Avoid known test failures. */ int known_failure = 0; - /* The '4' tests do not work on Linux/powerpc* and Linux/s390*, as well as - on GNU/kFreeBSD/i386, GNU/kFreeBSD/x86_64, musl libc/i386, - musl libc/powerpc64le, macOS/i386, macOS/x86_64, macOS/arm64, - FreeBSD/i386, FreeBSD/x86_64, NetBSD/i386, NetBSD/x86_64, OpenBSD/i386, - OpenBSD/x86_64, AIX/powerpc, Solaris/i386, Solaris/x86_64, - Cygwin/x86_64, native Windows/i386, - native Windows/x86_64. */ - #if (__GLIBC__ >= 2 && (defined __powerpc__ || (defined __s390__ || defined __s390x__))) \ + /* The '4' tests do not work + - on glibc/{i386,x86_64}, with gcc < 8 (except when option -mno-ieee-fp + is used) or with clang, + - on glibc/powerpc* and glibc/s390*, + - as well as on + GNU/kFreeBSD/i386, GNU/kFreeBSD/x86_64, + musl libc/i386, musl libc/powerpc64le, + macOS/i386, macOS/x86_64, macOS/arm64, + FreeBSD/i386, FreeBSD/x86_64, + NetBSD/i386, NetBSD/x86_64, + OpenBSD/i386, OpenBSD/x86_64, + AIX/powerpc, + Solaris/i386, Solaris/x86_64, + Cygwin/x86_64, + native Windows/i386, native Windows/x86_64. + Explanation of some of the {i386,x86_64} cases: + - Quoting the Intel 64 and IA-32 Architectures Software Developer's + Manual: + "The UCOMISD instruction differs from the COMISD instruction in that + it signals a SIMD floating-point invalid operation exception (#I) + only when a source operand is an SNaN. The COMISD instruction + signals an invalid numeric exception only if a source operand is + either an SNaN or a QNaN." + - gcc < 8 (except when option -mno-ieee-fp is used) generates 'ucom*' + or 'fucom*' instructions and thus fails the test. + - gcc >= 8 generates 'com*' or 'fcom*' instructions and thus passes + the test. */ + #if (__GLIBC__ >= 2 && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)) && __GNUC__ < 8) \ + || (__GLIBC__ >= 2 && (defined __powerpc__ || (defined __s390__ || defined __s390x__))) \ || (__GLIBC__ >= 2 && __FreeBSD_kernel__ && ((defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86))) \ || (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__)) \ -- 2.39.5