[PATCH] Fix PR57075
Richard Biener
rguenther@suse.de
Mon Apr 29 18:17:00 GMT 2013
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.
2013-04-29 Richard Biener <rguenther@suse.de>
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.dg/torture/pr57075.c: New testcase.
Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c (revision 198409)
--- gcc/tree-inline.c (working copy)
*************** copy_edges_for_bb (basic_block bb, gcov_
*** 1923,1933 ****
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);
if (can_throw || nonlocal_goto)
{
--- 1927,1933 ----
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);
! nonlocal_goto = stmt_can_make_abnormal_goto (copy_stmt);
if (can_throw || nonlocal_goto)
{
*************** copy_edges_for_bb (basic_block bb, gcov_
*** 1955,1960 ****
--- 1955,1964 ----
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);
Index: gcc/testsuite/gcc.dg/torture/pr57075.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr57075.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr57075.c (working copy)
***************
*** 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 ();
+ }
More information about the Gcc-patches
mailing list