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

            Bug ID: 68375
           Summary: [6 Regression] ICE in get_loop_body_in_bfs_order when
                    dumping cfg with -fdump-tree-optimized-graph
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

I was investigating the testcase from PR 68194

int printf (const char *, ...); 

int a, c, d, e, g, h;
short f;

short
fn1 () 
{
  int j[2];
  for (; e; e++)
    if (j[0])
      for (;;)
        ;
  if (!g)
    return f;
}

int
main ()
{
  for (; a < 1; a++)
    {
      for (c = 0; c < 2; c++)
        { 
          d && (f = 0); 
          h = fn1 (); 
        }
      printf ("%d\n", (char) f);   
   }

 return 0;
}

and hit an ICe when compiling with -fdump-tree-optimized-graph -O2:
internal compiler error: in get_loop_body_in_bfs_order, at cfgloop.c:944
 fn1 ()
 ^~~

0x7114e8 get_loop_body_in_bfs_order(loop const*)
        ../../gcc/gcc/cfgloop.c:944
0x1166ce2 draw_cfg_nodes_for_loop
        ../../gcc/gcc/graph.c:220
0x1166cad draw_cfg_nodes_for_loop
        ../../gcc/gcc/graph.c:212
0x1166e64 draw_cfg_nodes
        ../../gcc/gcc/graph.c:242
0x1166e64 print_graph_cfg(char const*, function*)
        ../../gcc/gcc/graph.c:288
0xa17806 execute_function_dump
        ../../gcc/gcc/passes.c:1751
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

The assert "gcc_assert (i > vc);" triggers.
Changing it to "gcc_assert (i >= vc);" fixes it for me but it was explicitly
changed to i > vc from i >= vc with:

    2015-06-09  Richard Biener  <rguent...@suse.de>

        * cfgloop.c (get_loop_body_in_bfs_order): Fix assert.

so there must be something I'm missing?

Reply via email to