https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88105

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-11-20
            Version|unknown                     |8.2.1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
   Target Milestone|---                         |7.4
            Summary|Possibly infinite loop in   |[7/8/9 Regression] Possibly
                   |pass_dominator::execute     |infinite loop in
                   |                            |pass_dominator::execute
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

779               while (single_succ_p (bb)
780                      && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
781                 bb = single_succ (bb);

and we end up in an infinite loop for

<bb 6> [local count: 1073741824]:

<bb 11> [local count: 1073741824]:
goto <bb 6>; [100.00%]

reached by a loop exit we eliminated.  Fix:

diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index c50618dc809..7787da8b237 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -777,7 +777,8 @@ pass_dominator::execute (function *fun)
          if (bb == NULL)
            continue;
          while (single_succ_p (bb)
-                && (single_succ_edge (bb)->flags & EDGE_EH) == 0)
+                && (single_succ_edge (bb)->flags
+                    & (EDGE_EH|EDGE_DFS_BACK)) == 0)
            bb = single_succ (bb);
          if (bb == EXIT_BLOCK_PTR_FOR_FN (fun))
            continue;

Reply via email to