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

            Bug ID: 69740
           Summary: gcc ICE at -O2 and above on valid code on
                    x86_64-linux-gnu in "verify_loop_structure"
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

The following valid code causes an ICE when compiled with the current gcc trunk
at -O2 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.


$ 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/6.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 6.0.0 20160209 (experimental) [trunk revision 233242] (GCC)



$ gcc-trunk abc.c -c
$ gcc-trunk abc.c -c -O2
abc.c: In function 'fn1':
abc.c:12:1: error: loop with header 4 not in loop tree
 }
 ^
abc.c:12:1: internal compiler error: in verify_loop_structure, at
cfgloop.c:1639
0x75e2ff verify_loop_structure()
        ../../gcc/gcc/cfgloop.c:1639
0x9d95ae checking_verify_loop_structure
        ../../gcc/gcc/cfgloop.h:324
0x9d95ae loop_optimizer_init(unsigned int)
        ../../gcc/gcc/loop-init.c:106
0xaaed32 execute
        ../../gcc/gcc/predict.c:3033
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.


——
$ cat abc.c
char a;
short b;
void fn1() {
  if (b)
    ;
  else {
    int c[1] = {0};
  l1:;
  }
  if (a)
    goto l1;
}

Reply via email to