[Bug middle-end/53695] [4.8 Regression] ICE: in dfs_enumerate_from, at cfganal.c:1221 with -O2 -ftracer and labels/gotos

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Thu Aug 23 11:22:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53695

--- Comment #21 from rguenther at suse dot de <rguenther at suse dot de> 2012-08-23 11:22:19 UTC ---
On Thu, 23 Aug 2012, rguenther at suse dot de wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53695
> 
> Btw, another idea would be to make labels that are target of
> abnormal edges end a basic-block.  That way you'd have the
> edges "pre-split".

Like so, doesn't help this testcase but maybe the Fortran issues.

Richard.

Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c    (revision 190613)
+++ gcc/tree-cfg.c    (working copy)
@@ -670,6 +674,10 @@ make_edges (void)
           }
           break;

+        case GIMPLE_LABEL:
+          fallthru = true;
+          break;
+
         default:
           gcc_assert (!stmt_ends_bb_p (last));
           fallthru = true;
@@ -2440,7 +2527,9 @@ stmt_starts_bb_p (gimple stmt, gimple pr
 bool
 stmt_ends_bb_p (gimple t)
 {
-  return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
+  return (is_ctrl_stmt (t) || is_ctrl_altering_stmt (t)
+      || (gimple_code (t) == GIMPLE_LABEL
+          && FORCED_LABEL (gimple_label_label (t))));
 }

 /* Remove block annotations and other data structures.  */
Index: gcc/tree-cfgcleanup.c
===================================================================
--- gcc/tree-cfgcleanup.c    (revision 190613)
+++ gcc/tree-cfgcleanup.c    (working copy)
@@ -300,7 +300,8 @@ tree_forwarder_block_p (basic_block bb,
       switch (gimple_code (stmt))
     {
     case GIMPLE_LABEL:
-      if (DECL_NONLOCAL (gimple_label_label (stmt)))
+      if (DECL_NONLOCAL (gimple_label_label (stmt))
+          || FORCED_LABEL (gimple_label_label (stmt)))
         return false;
       if (optimize == 0 && gimple_location (stmt) != locus)
         return false;



More information about the Gcc-bugs mailing list