aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYury Gribov <tetra2005@gmail.com>2017-09-29 19:40:16 +0000
committerYury Gribov <ygribov@gcc.gnu.org>2017-09-29 19:40:16 +0000
commitb09bf97bcd51adcc554e21213cd4159db95805a3 (patch)
treee6a08f58f36898a8bc37718b1bc4815f2753ea0d /gcc
parent6e3e841997276a3a3ac5c90b253ba235d8262990 (diff)
downloadgcc-b09bf97bcd51adcc554e21213cd4159db95805a3.zip
gcc-b09bf97bcd51adcc554e21213cd4159db95805a3.tar.gz
gcc-b09bf97bcd51adcc554e21213cd4159db95805a3.tar.bz2
re PR middle-end/82319 (ICE in generic_simplify_148, at generic-match.c:6436)
2017-09-29 Yury Gribov <tetra2005@gmail.com> PR middle-end/82319 gcc/ * match.pd: Fix handling of NaNs in pattern. gcc/testsuite/ * c-c++/common/pr57371-4.c: Test NaN comparisons. From-SVN: r253307
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/match.pd2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/pr57371-4.c12
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1932390..2063108 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-29 Yury Gribov <tetra2005@gmail.com>
+
+ PR middle-end/82319
+ * match.pd: Fix handling of NaNs in pattern.
+
2017-09-29 Jeff Law <law@redhat.com>
* sbitmap.c (bitmap_bit_in_range_p): New function.
diff --git a/gcc/match.pd b/gcc/match.pd
index 43ab226..1136a59 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2961,7 +2961,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
else
real_trunc (&icst, fmt, cst);
- bool cst_int_p = real_identical (&icst, cst);
+ bool cst_int_p = !real_isnan (cst) && real_identical (&icst, cst);
bool overflow_p = false;
wide_int icst_val
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0cf96a9..8cb533b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-29 Yury Gribov <tetra2005@gmail.com>
+
+ PR middle-end/82319
+ * c-c++/common/pr57371-4.c: Test NaN comparisons.
+
2017-09-29 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/other/dump-ada-spec-10.C: New test.
diff --git a/gcc/testsuite/c-c++-common/pr57371-4.c b/gcc/testsuite/c-c++-common/pr57371-4.c
index 6265f52..f43f7c2 100644
--- a/gcc/testsuite/c-c++-common/pr57371-4.c
+++ b/gcc/testsuite/c-c++-common/pr57371-4.c
@@ -69,4 +69,16 @@ void nonfinite(unsigned short x) {
nonfinite_10 = (float) x != SNAN;
/* { dg-final { scan-tree-dump "nonfinite_10 = \\(float\\)" "original" } } */
}
+
+ {
+ volatile int nonfinite_11;
+ nonfinite_11 = (float) x == QNAN;
+ /* { dg-final { scan-tree-dump "nonfinite_11 = 0" "original" } } */
+ }
+
+ {
+ volatile int nonfinite_12;
+ nonfinite_12 = (float) x != QNAN;
+ /* { dg-final { scan-tree-dump "nonfinite_12 = 1" "original" } } */
+ }
}