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

            Bug ID: 71802
           Summary: gcc ICE at -O3 on valid code on x86_64-linux-gnu in
                    expand_LOOP_VECTORIZED
           Product: gcc
           Version: 7.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 only -O3 on x86_64-linux-gnu in both 32- and 64-bit modes.


It appears to be a 7 regression.


$ 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/7.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 7.0.0 20160707 (experimental) [trunk revision 238108] (GCC) 



$ gcc-trunk -O3 abc.c
abc.c: In function ‘fn1’:
abc.c:26:7: warning: assignment from incompatible pointer type
[-Wincompatible-pointer-types]
     i = &h;
       ^
abc.c:28:7: warning: assignment from incompatible pointer type
[-Wincompatible-pointer-types]
     i = &f;
       ^
abc.c:3:6: internal compiler error: in expand_LOOP_VECTORIZED, at
internal-fn.c:1944
 void fn1() {
      ^~~
0x969f07 expand_LOOP_VECTORIZED
        ../../gcc/gcc/internal-fn.c:1944
0x75a117 expand_call_stmt
        ../../gcc/gcc/cfgexpand.c:2573
0x75a117 expand_gimple_stmt_1
        ../../gcc/gcc/cfgexpand.c:3574
0x75a117 expand_gimple_stmt
        ../../gcc/gcc/cfgexpand.c:3740
0x75d700 expand_gimple_basic_block
        ../../gcc/gcc/cfgexpand.c:5747
0x7624c6 execute
        ../../gcc/gcc/cfgexpand.c:6362
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
int b, c;
long d, f;
void fn1() {
  char g;
  long long h = 0;
  int *i;
  if (0) {
  L2:
    b && (b = f);
    d = 3;
    for (; d;) {
      char *j = &g;
      c = *j = 0;
    L3:
      *j %= b;
      for (; g <= 4;)
        ;
    }
    goto L2;
  }
  for (; *i; *i = 1) {
    if ((h -= 4) == (h != (b ?: d))) {
      g = 3;
      goto L3;
    }
    i = &h;
    *i = f;
    i = &f;
    if ((h && 6) - (h = 0))
      goto L2;
  }
  for (; d;)
    goto L3;
}

Reply via email to