From 0409237b686b5daa66810427652acd53761d270b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 6 Jul 2015 10:37:33 +0000 Subject: [PATCH] re PR tree-optimization/66759 (ICE in generic-match.c on 456.hmmer) 2015-07-06 Richard Biener 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 | 6 ++++++ gcc/match.pd | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr66759.c | 11 +++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr66759.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 234468c71a1..5e7108a6479 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-07-06 Richard Biener + + 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 PR tree-optimization/66757 diff --git a/gcc/match.pd b/gcc/match.pd index ae0d9f11134..f850d523265 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -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))))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d51e6068a6e..efe389df056 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-06 Richard Biener + + PR middle-end/66759 + * gcc.dg/torture/pr66759.c: New testcase. + 2015-07-06 Andre Vehreschild 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 index 00000000000..3e5d720ee1f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66759.c @@ -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; +} -- 2.30.2