From 52270a3cb5384afea9773dfc122412a0fcf5957e Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Fri, 19 Aug 2005 18:08:55 +0000 Subject: [PATCH] re PR tree-optimization/23476 (ICE in VRP, remove_range_assertions) PR 23476 * tree-cfgcleanup.c (cleanup_control_expr_graph): Fold the conditional expression before testing its value. PR 23476 * gcc.c-torture/compile/pr23476.c: New test. From-SVN: r103290 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr23476.c | 14 ++++++++++++++ gcc/tree-cfgcleanup.c | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr23476.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b7465ab5cec..f19ee5c5b6c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-08-19 Diego Novillo + + PR 23476 + * tree-cfgcleanup.c (cleanup_control_expr_graph): Fold the + conditional expression before testing its value. + 2005-08-19 Diego Novillo * doc/invoke.texi: Fix documentation for -ftree-dominator-opts. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ffb5f0557673..5abaa13028bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-08-19 Diego Novillo + + PR 23476 + * gcc.c-torture/compile/pr23476.c: New test. + 2005-08-19 Devang Patel PR tree-optimization/23048 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr23476.c b/gcc/testsuite/gcc.c-torture/compile/pr23476.c new file mode 100644 index 000000000000..9cccde6e9b2e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr23476.c @@ -0,0 +1,14 @@ +int h(int); +int t; +static inline int f(const int i) +{ + int tt = i; + _Bool a = i < t; + if (a) + return h(t); + return 9; +} +int g(void) +{ + return f(0x7FFFFFFF); +} diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index f8bca03e9df6..0f8bfc5ec1b5 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -81,11 +81,11 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi) switch (TREE_CODE (expr)) { case COND_EXPR: - val = COND_EXPR_COND (expr); + val = fold (COND_EXPR_COND (expr)); break; case SWITCH_EXPR: - val = SWITCH_COND (expr); + val = fold (SWITCH_COND (expr)); if (TREE_CODE (val) != INTEGER_CST) return false; break;