From e770bfd997bb5803b88ca4081bdbca3e250fc92e Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 18 Sep 2014 13:00:21 +0100 Subject: Fix i386 FP_TRAPPING_EXCEPTIONS. The i386 sfp-machine.h defines FP_TRAPPING_EXCEPTIONS in a way that is always wrong: it treats a set bit as indicating the exception is trapping, when actually a set bit (both for 387 and SSE floating point) indicates it is masked, and a clear bit indicates it is trapping. This patch fixes this bug. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. libgcc: * config/i386/sfp-machine.h (FP_TRAPPING_EXCEPTIONS): Treat clear bits not set bits as indicating trapping exceptions. gcc/testsuite: * gcc.dg/torture/float128-exact-underflow.c: New test. From-SVN: r215347 --- libgcc/ChangeLog | 5 +++++ libgcc/config/i386/sfp-machine.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 6c6e386..fa432395 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-18 Joseph Myers + + * config/i386/sfp-machine.h (FP_TRAPPING_EXCEPTIONS): Treat clear + bits not set bits as indicating trapping exceptions. + 2014-09-17 Nathan sidwell * Makefile.in (LIBGCOV_INTERFACE): Add _gcov_dump from ... diff --git a/libgcc/config/i386/sfp-machine.h b/libgcc/config/i386/sfp-machine.h index 148044a..8a1923b 100644 --- a/libgcc/config/i386/sfp-machine.h +++ b/libgcc/config/i386/sfp-machine.h @@ -60,7 +60,7 @@ void __sfp_handle_exceptions (int); __sfp_handle_exceptions (_fex); \ } while (0); -#define FP_TRAPPING_EXCEPTIONS ((_fcw >> FP_EX_SHIFT) & FP_EX_ALL) +#define FP_TRAPPING_EXCEPTIONS ((~_fcw >> FP_EX_SHIFT) & FP_EX_ALL) #define FP_ROUNDMODE (_fcw & FP_RND_MASK) #endif -- cgit v1.1