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

            Bug ID: 85615
           Summary: ICE at -O2 and above on valid code on
                    x86_64-linux-gnu: in dfs_enumerate_from, at
                    cfganal.c:1197
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

As the title. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 9.0.0 20180502 (experimental) [trunk revision 259838] (GCC)



$ gcc-trunk -O2 abc.c
during GIMPLE pass: vrp
abc.c: In function ‘fn1’:
abc.c:3:6: internal compiler error: in dfs_enumerate_from, at cfganal.c:1197
 void fn1() {
      ^~~
0x5fc743 dfs_enumerate_from(basic_block_def*, int, bool (*)(basic_block_def
const*, void const*), basic_block_def**, int, void const*)
        ../../gcc/gcc/cfganal.c:1197
0xe97e21 determine_bb_domination_status(loop*, basic_block_def*)
        ../../gcc/gcc/tree-ssa-threadupdate.c:1501
0xe9a541 thread_through_loop_header
        ../../gcc/gcc/tree-ssa-threadupdate.c:1648
0xe9a541 thread_through_all_blocks(bool)
        ../../gcc/gcc/tree-ssa-threadupdate.c:2391
0xf2ddb5 execute_vrp
        ../../gcc/gcc/tree-vrp.c:7050
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ cat abc.c
long a, d;
int b, c;
void fn1() {
  int e = -1L, f = 2, g = 8;
  for (;;) {
    for (; b; g++)
      ;
    int i;
    for (; c;) {
      i = 5;
      for (; e >= 1; i--)
        ;
    }
    d = f ?: a;
    if (d) {
      e = 0;
      for (; i;)
        for (; g < 3; f++)
          ;
    }
  }
}

Reply via email to