[backport gcc-4.9/trunk r198423, fixes PR57075 regression from PR57036 fix, which itself fixed a regression from PR56982 fix ] List-Archive: Date: Mon, 29 Apr 2013 15:29:54 +0200 (CEST) From: Richard Biener Subject: [PATCH] Fix PR57075 When fixing PR57036 made the inliner not add abnormal edges from calls to non-local labels or setjmps I made it not split the blocks after the possible source of abnormal control flow. That turns out to upset the CFG verifier so the following re-instantiates splitting of blocks. Bootstrap & regtest ongoing on x86_64-unknown-linux-gnu. Richard. gcc/ 2013-04-29 Richard Biener PR middle-end/57075 * tree-inline.c (copy_edges_for_bb): Still split the bbs, even if not adding abnormal edges for calls that can make abnormal gotos. gcc/testsuite/ 2013-04-29 Richard Biener PR middle-end/57075 * gcc.dg/torture/pr57075.c: New testcase. --- gcc-4.8.0/gcc/testsuite/gcc.dg/torture/pr57075.c.~1~ 1970-01-01 01:00:00.000000000 +0100 +++ gcc-4.8.0/gcc/testsuite/gcc.dg/torture/pr57075.c 2013-04-30 12:05:23.906496421 +0200 @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +extern int baz (void) __attribute__ ((returns_twice)); +int __attribute__ ((__leaf__)) +foo (void) +{ + return __builtin_printf ("$"); +} + +void +bar () +{ + foo (); + baz (); +} --- gcc-4.8.0/gcc/tree-inline.c.~1~ 2013-04-30 11:59:36.477811665 +0200 +++ gcc-4.8.0/gcc/tree-inline.c 2013-04-30 12:05:23.906496421 +0200 @@ -1922,11 +1922,7 @@ copy_edges_for_bb (basic_block bb, gcov_ into a COMPONENT_REF which doesn't. If the copy can throw, the original could also throw. */ can_throw = stmt_can_throw_internal (copy_stmt); - /* If the call we inline cannot make abnormal goto do not add - additional abnormal edges but only retain those already present - in the original function body. */ - nonlocal_goto - = can_make_abnormal_goto && stmt_can_make_abnormal_goto (copy_stmt); + nonlocal_goto = stmt_can_make_abnormal_goto (copy_stmt); if (can_throw || nonlocal_goto) { @@ -1954,6 +1950,10 @@ copy_edges_for_bb (basic_block bb, gcov_ else if (can_throw) make_eh_edges (copy_stmt); + /* If the call we inline cannot make abnormal goto do not add + additional abnormal edges but only retain those already present + in the original function body. */ + nonlocal_goto &= can_make_abnormal_goto; if (nonlocal_goto) make_abnormal_goto_edges (gimple_bb (copy_stmt), true);