re PR tree-optimization/46165 (ICE: verify_flow_info failed when casting-out attribut...
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Nov 2010 10:34:34 +0000 (11:34 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Nov 2010 10:34:34 +0000 (11:34 +0100)
PR tree-optimization/46165
* tree-ssa-pre.c (eliminate): Return TODO_cleanup_cfg if changing
a normal call into noreturn call.

* gcc.dg/pr46165.c: New test.

From-SVN: r166236

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46165.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 6d4d1b5a96ca3deff2a1ac0e29e7a2001b19f448..0454a9fee826e7ce86850ae65c78a4bd8f2d77a5 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46165
+       * tree-ssa-pre.c (eliminate): Return TODO_cleanup_cfg if changing
+       a normal call into noreturn call.
+
 2010-11-03  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/46251
index 184ebdb8879818f5a69b66df91451a882e98fb4d..d97167acda6b4efbdecf72a3080b85a2ebc38c7b 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46165
+       * gcc.dg/pr46165.c: New test.
+
 2010-11-03  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/46251
diff --git a/gcc/testsuite/gcc.dg/pr46165.c b/gcc/testsuite/gcc.dg/pr46165.c
new file mode 100644 (file)
index 0000000..a13300e
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR tree-optimization/46165 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" } */
+
+extern void foo (void) __attribute__((noreturn));
+void
+g (void)
+{
+  void (*f) (void) = foo;
+  f ();
+}
index 8f91bd699b8645f1462274b36f236bc00f482eb6..fda94375b144a013d667d6d173bcb891a96f1e22 100644 (file)
@@ -4364,6 +4364,7 @@ eliminate (void)
                {
                  bool can_make_abnormal_goto
                    = stmt_can_make_abnormal_goto (stmt);
+                 bool was_noreturn = gimple_call_noreturn_p (stmt);
 
                  if (dump_file && (dump_flags & TDF_DETAILS))
                    {
@@ -4376,6 +4377,11 @@ eliminate (void)
                  gimple_call_set_fn (stmt, fn);
                  update_stmt (stmt);
 
+                 /* When changing a call into a noreturn call, cfg cleanup
+                    is needed to fix up the noreturn call.  */
+                 if (!was_noreturn && gimple_call_noreturn_p (stmt))
+                   todo |= TODO_cleanup_cfg;
+
                  /* If we removed EH side-effects from the statement, clean
                     its EH information.  */
                  if (maybe_clean_or_replace_eh_stmt (stmt, stmt))