summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorramana <ramana@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-21 08:27:47 +0000
committerramana <ramana@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-21 08:27:47 +0000
commit04aca775de7d80107005933e4933d06e3b27b06c (patch)
tree3973337fb07a5c53e6c89382ef87a62c8ee3a2c6 /gcc
parent5a5a7a90ecadbeec5011f8fc883eb365aa7745a4 (diff)
downloadgcc-04aca775de7d80107005933e4933d06e3b27b06c.tar.gz
[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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238584 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/pr59833.c18
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 00000000000..e0e4ed5c5cc
--- /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;
+}