Inconsistent next_bb info when EXIT is a successor

Andrey Belevantsev abel@ispras.ru
Fri Mar 2 17:08:00 GMT 2007


Hello,

During my work on the selective scheduler I have triggered an assert in 
our code saying that a fall-through edge should have e->src->next_bb == 
e->dest. This was for a bb with EXIT_BLOCK as its fall-through 
successor, but its next_bb pointing to another block.

I was wondering why verify_flow_info didn't catch this issue.  The code 
starting at cfgrtl.c:1973 (in the January 03 trunk) does check this, but 
only when e->src != ENTRY_BLOCK_PTR && e->dest != EXIT_BLOCK_PTR.

I have tried to reorganize the check so that the "e->src->next_bb == 
e->dest" condition is checked for all edges (see the patch below).  Of 
course, GCC does not bootstrap with this patch, triggering an assert of 
incorrect fallthru block in cfg_layout_finalize, after RTL loop 
optimizations.  In my case, combine has broken that condition.

Does this ring any bells to anybody?  Is this a bug, or should this 
condition not be checked for edges pointing to the exit block at all?

Thanks, Andrey

--- cfgrtl.c    (revision 24203)
+++ cfgrtl.c    (local)
@@ -1969,8 +1969,7 @@ rtl_verify_flow_info (void)
                   break;
                 }
         }
-      else if (e->src != ENTRY_BLOCK_PTR
-              && e->dest != EXIT_BLOCK_PTR)
+      else
         {
           rtx insn;

@@ -1981,7 +1980,9 @@ rtl_verify_flow_info (void)
                  e->src->index, e->dest->index);
               err = 1;
             }
-         else
+
+          if (e->src != ENTRY_BLOCK_PTR
+              && e->dest != EXIT_BLOCK_PTR)
             for (insn = NEXT_INSN (BB_END (e->src)); insn != BB_HEAD 
(e->dest);
                  insn = NEXT_INSN (insn))
               if (BARRIER_P (insn) || INSN_P (insn))



More information about the Gcc mailing list