There are a few if statements in cfgrtl.c that are very fragile in the
sense that introducing an irrelevant edge flag breaks things.

This patch rewrites them to avoid such breakage.

--

2014-07-16  Yi Yang  <ahyan...@google.com>

gcc:
    * cfgrtl.c (rtl_verify_edges, purge_dead_edges): Rewrite certain
if statements.

---

diff --git gcc/cfgrtl.c gcc/cfgrtl.c
index 148c19d..f98ba15 100644
--- gcc/cfgrtl.c
+++ gcc/cfgrtl.c
@@ -2468,12 +2468,12 @@ rtl_verify_edges (void)
       err = 1;
     }

-  if ((e->flags & ~(EDGE_DFS_BACK
-    | EDGE_CAN_FALLTHRU
-    | EDGE_IRREDUCIBLE_LOOP
-    | EDGE_LOOP_EXIT
-    | EDGE_CROSSING
-    | EDGE_PRESERVE)) == 0)
+  if ((e->flags & (EDGE_ABNORMAL_CALL
+   | EDGE_SIBCALL
+   | EDGE_EH
+   | EDGE_ABNORMAL
+   | EDGE_FALLTHRU
+   | EDGE_FAKE)) == 0)
     n_branch++;

   if (e->flags & EDGE_ABNORMAL_CALL)
@@ -3138,8 +3138,13 @@ purge_dead_edges (basic_block bb)
  have created the sibcall in the first place.  Second, there
  should of course never have been a fallthru edge.  */
       gcc_assert (single_succ_p (bb));
-      gcc_assert (single_succ_edge (bb)->flags
-  == (EDGE_SIBCALL | EDGE_ABNORMAL));
+      gcc_assert ((single_succ_edge (bb)->flags
+   & (EDGE_FALLTHRU
+      | EDGE_SIBCALL
+      | EDGE_ABNORMAL
+      | EDGE_EH
+      | EDGE_ABNORMAL_CALL)) ==
+  (EDGE_SIBCALL | EDGE_ABNORMAL));

       return 0;
     }
-- 
2.0.0.526.g5318336

Reply via email to