re PR tree-optimization/66759 (ICE in generic-match.c on 456.hmmer)
authorRichard Biener <rguenther@suse.de>
Mon, 6 Jul 2015 10:37:33 +0000 (10:37 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 6 Jul 2015 10:37:33 +0000 (10:37 +0000)
2015-07-06  Richard Biener  <rguenther@suse.de>

PR middle-end/66759
* match.pd: Add missing constraint of y to REAL_CST in
REAL_CST - x CMP y to y - CST CMP x simplification.

* gcc.dg/torture/pr66759.c: New testcase.

From-SVN: r225449

gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr66759.c [new file with mode: 0644]

index 234468c71a1bb7eff6425240e06078b5fa58bd5e..5e7108a64792adac10795e899a3e06e6d11e1018 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-06  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/66759
+       * match.pd: Add missing constraint of y to REAL_CST in
+       REAL_CST - x CMP y to y - CST CMP x simplification.
+
 2015-07-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR tree-optimization/66757
index ae0d9f11134d0e34c03dbaf8cceb9a7a65839a21..f850d5232654a70a9801ff2779dc3379476c42ab 100644 (file)
@@ -1497,7 +1497,7 @@ along with GCC; see the file COPYING3.  If not see
     floating-point types only if -fassociative-math is set.  */
  (if (flag_associative_math)
   (simplify
-   (cmp (minus REAL_CST@0 @1) @2)
+   (cmp (minus REAL_CST@0 @1) REAL_CST@2)
    (with { tree tem = const_binop (MINUS_EXPR, TREE_TYPE (@1), @0, @2); }
     (if (!TREE_OVERFLOW (tem))
      (cmp { tem; } @1)))))
index d51e6068a6ebd0a3556f3b2f6f4494eb4b4f42c8..efe389df056d39a6546ac8215971143dffba0fcf 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-06  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/66759
+       * gcc.dg/torture/pr66759.c: New testcase.
+
 2015-07-06  Andre Vehreschild  <vehre@gmx.de>
 
        PR fortran/58586
diff --git a/gcc/testsuite/gcc.dg/torture/pr66759.c b/gcc/testsuite/gcc.dg/torture/pr66759.c
new file mode 100644 (file)
index 0000000..3e5d720
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ffast-math" } */
+
+int a, b;
+float c;
+int fn2();
+void fn1()
+{
+  if (fn2() <= 1. - c)
+    b = a;
+}