From c83ee180191ab19daabee8edefa3e8cf4d00b67f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 17 Sep 2014 21:05:49 +0200 Subject: re PR debug/63284 (-fcompare-debug issue due to redirection to __builtin_unreachable ()) PR debug/63284 * tree-cfgcleanup.c (fixup_noreturn_call): Don't split block if there are only debug stmts after the noreturn call, instead remove the debug stmts. * gcc.dg/pr63284.c: New test. From-SVN: r215331 --- gcc/tree-cfgcleanup.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gcc/tree-cfgcleanup.c') diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index a66ec6e7537..451630f1563 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -565,7 +565,20 @@ fixup_noreturn_call (gimple stmt) /* First split basic block if stmt is not last. */ if (stmt != gsi_stmt (gsi_last_bb (bb))) - split_block (bb, stmt); + { + if (stmt == gsi_stmt (gsi_last_nondebug_bb (bb))) + { + /* Don't split if there are only debug stmts + after stmt, that can result in -fcompare-debug + failures. Remove the debug stmts instead, + they should be all unreachable anyway. */ + gimple_stmt_iterator gsi = gsi_for_stmt (stmt); + for (gsi_next (&gsi); !gsi_end_p (gsi); ) + gsi_remove (&gsi, true); + } + else + split_block (bb, stmt); + } changed |= remove_fallthru_edge (bb->succs); -- cgit v1.2.1