+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
+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
--- /dev/null
+/* 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 ();
+}
{
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))
{
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))