OSDN Git Service

PR 23476
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Aug 2005 18:08:55 +0000 (18:08 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Aug 2005 18:08:55 +0000 (18:08 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103290 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr23476.c [new file with mode: 0644]
gcc/tree-cfgcleanup.c

index 7b7465a..f19ee5c 100644 (file)
@@ -1,5 +1,11 @@
 2005-08-19  Diego Novillo  <dnovillo@redhat.com>
 
+       PR 23476
+       * tree-cfgcleanup.c (cleanup_control_expr_graph): Fold the
+       conditional expression before testing its value.
+
+2005-08-19  Diego Novillo  <dnovillo@redhat.com>
+
        * doc/invoke.texi: Fix documentation for -ftree-dominator-opts.
 
 2005-08-19  Devang Patel  <dpatel@apple.com>
index ffb5f05..5abaa13 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-19  Diego Novillo  <dnovillo@redhat.com>
+
+       PR 23476
+       * gcc.c-torture/compile/pr23476.c: New test.
+
 2005-08-19  Devang Patel  <dpatel@apple.com>
 
        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 (file)
index 0000000..9cccde6
--- /dev/null
@@ -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);
+}
index f8bca03..0f8bfc5 100644 (file)
@@ -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;