From f980c9a2622743e44456727a13c612b1c520c7f4 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 5 Aug 2015 07:42:54 +0000 Subject: [PATCH] re PR c/67107 (ICE: SIGSEGV in tree_class_check with -frounding-math -funsafe-math-optimizations) 2015-08-05 Richard Biener PR middle-end/67107 * match.pd: Guard const_binop result checking against NULL_TREE result. * gcc.dg/pr67107.c: New testcase. From-SVN: r226609 --- gcc/ChangeLog | 6 ++++++ gcc/match.pd | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr67107.c | 7 +++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr67107.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c8e1765d31..09a89eef409 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-08-05 Richard Biener + + PR middle-end/67107 + * match.pd: Guard const_binop result checking against NULL_TREE + result. + 2015-08-05 Kugan Vivekanandarajah * cse.c (cse_insn): Restoring old behaviour for src_eqv diff --git a/gcc/match.pd b/gcc/match.pd index 3e9100e81f0..2a4f7d698e4 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1599,7 +1599,7 @@ along with GCC; see the file COPYING3. If not see tree tem = const_binop (op == PLUS_EXPR ? MINUS_EXPR : PLUS_EXPR, TREE_TYPE (@1), @2, @1); } - (if (!TREE_OVERFLOW (tem)) + (if (tem && !TREE_OVERFLOW (tem)) (cmp @0 { tem; })))))) /* Likewise, we can simplify a comparison of a real constant with @@ -1610,7 +1610,7 @@ along with GCC; see the file COPYING3. If not see (simplify (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)) + (if (tem && !TREE_OVERFLOW (tem)) (cmp { tem; } @1))))) /* Fold comparisons against built-in math functions. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8471c040c66..1a5d6f932ae 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-05 Richard Biener + + PR middle-end/67107 + * gcc.dg/pr67107.c: New testcase. + 2015-08-04 Paolo Carlini PR c++/66197 diff --git a/gcc/testsuite/gcc.dg/pr67107.c b/gcc/testsuite/gcc.dg/pr67107.c new file mode 100644 index 00000000000..e2e11c0f9e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67107.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-frounding-math -funsafe-math-optimizations" } */ + +int test () +{ + return 5.0 < 5.0 - 0.1; +} -- 2.30.2