diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2016-07-21 08:27:47 +0000 |
---|---|---|
committer | Ramana Radhakrishnan <ramana@gcc.gnu.org> | 2016-07-21 08:27:47 +0000 |
commit | a1b01d34036c85f23b7ca1a2c99e5b6bb0b8e68c (patch) | |
tree | 3973337fb07a5c53e6c89382ef87a62c8ee3a2c6 /gcc | |
parent | 23974819345d2dc793cc77c85a5d84d05c787fa2 (diff) | |
download | gcc-a1b01d34036c85f23b7ca1a2c99e5b6bb0b8e68c.zip gcc-a1b01d34036c85f23b7ca1a2c99e5b6bb0b8e68c.tar.gz gcc-a1b01d34036c85f23b7ca1a2c99e5b6bb0b8e68c.tar.bz2 |
[ARM] Fix PR target/59833
For Aurelien Jarno <aurelien@aurel32.net>
On ARM soft-float, the float to double conversion doesn't convert a sNaN
to qNaN as the IEEE Std 754 standard mandates:
"Under default exception handling, any operation signaling an invalid
operation exception and for which a floating-point result is to be
delivered shall deliver a quiet NaN."
Given the soft float ARM code ignores exceptions and always provides a
result, a float to double conversion of a signaling NaN should return a
quiet NaN. Fix this in extendsfdf2.
gcc/ChangeLog:
PR target/59833
* config/arm/ieee754-df.S (extendsfdf2): Convert sNaN to qNaN.
gcc/testsuite/ChangeLog:
* gcc.dg/pr59833.c: New testcase.
From-SVN: r238584
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr59833.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr59833.c b/gcc/testsuite/gcc.dg/pr59833.c new file mode 100644 index 0000000..e0e4ed5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr59833.c @@ -0,0 +1,18 @@ +/* { dg-do run { target { *-*-linux* *-*-gnu* } } } */ +/* { dg-options "-O0 -lm" } */ +/* { dg-require-effective-target issignaling } */ + +#define _GNU_SOURCE +#include <math.h> + +int main (void) +{ + float sNaN = __builtin_nansf (""); + double x = (double) sNaN; + if (issignaling(x)) + { + __builtin_abort(); + } + + return 0; +} |