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

            Bug ID: 91223
           Summary: [10 regression] ICE: in curr_insn_transform, at
                    lra-constraints.c:4459
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen at gmail dot com
  Target Milestone: ---

r273563 PASS
r273642 FAIL

$ /usr/local/gcc_current/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc_current/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/usr/local/gcc_current --enable-checking=yes,df,fold,rtl,extra
--enable-languages=c,c++,lto --disable-multilib --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array --with-isl --enable-offload-targets=nvptx-none
--without-cuda-driver --enable-gnu-indirect-function --with-tune=native
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.0 20190721 (experimental) [trunk revision 273642] (GCC) 

$ /usr/local/gcc_current/bin/gcc -fpreprocessed -O -c x.i
during RTL pass: reload
x.i: In function ‘d’:
x.i:35:1: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4459
   35 | }
      | ^
0x6c44d9 curr_insn_transform
        /home/dimhen/src/gcc_current/gcc/lra-constraints.c:4459
0xe5c58e lra_constraints(bool)
        /home/dimhen/src/gcc_current/gcc/lra-constraints.c:4987
0xe47a24 lra(_IO_FILE*)
        /home/dimhen/src/gcc_current/gcc/lra.c:2468
0xdf89a9 do_reload
        /home/dimhen/src/gcc_current/gcc/ira.c:5522
0xdf89a9 execute
        /home/dimhen/src/gcc_current/gcc/ira.c:5706
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 x.i
int a;
int *aw;
void *memcpy(void *, const void *, unsigned long);
typedef struct {
  int b;
} * c;
int d(void);
c e;
int *f;
int g;
int *h;
int d() {
  char bc[16];
bd:
  for (a = 0; a <= 1; a++) {
    *bc = *f;
    *(bc + 8 + 5) = *(bc + 8 + 6) = g + 1;
    unsigned long be[2];
    *be = bc[0] + bc[1];
    *(be + 1) = *(aw + bc[0]) * *aw;
    *be = *be ^ bc[1];
    *(be + 1) = *(be + 1) ^ (long)aw ^ bc[5] << 1 ^ *(unsigned long *)aw ^ *bc
^
                *(aw + bc[1]);
    *be = *be ^ *(aw + bc[13]);
    *(be + 1) = *(be + 1) ^ *(aw + bc[13] + 1);
    *be = *be ^ *(aw + 1) ^ bc[14] * bc[15];
    *(be + 1) = *(be + 1) ^ *aw;
    memcpy(bc, be, 16);
  }
  *(bc + 8) = *(bc + 8) ^ *f ^ e->b;
  memcpy(h, bc, 16);
  if (0)
    goto bd;
  return 0;
}

$ /usr/local/gcc_current/bin/gcc -fpreprocessed -O -c small_bad.i 
small_bad.i:1:9: warning: type defaults to ‘int’ in declaration of ‘a’
[-Wimplicit-int]
    1 | typedef a;
      |         ^
small_bad.i:2:1: warning: data definition has no type or storage class
    2 | d, e;
      | ^
small_bad.i:2:1: warning: type defaults to ‘int’ in declaration of ‘d’
[-Wimplicit-int]
small_bad.i:2:4: warning: type defaults to ‘int’ in declaration of ‘e’
[-Wimplicit-int]
    2 | d, e;
      |    ^
small_bad.i:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | f() {
      | ^
small_bad.i: In function ‘f’:
small_bad.i:11:40: warning: implicit declaration of function ‘j’
[-Wimplicit-function-declaration]
   11 |     *(g + (1 << h[1])) = *g << h[11] + j(0, 0, 0);
      |                                        ^
small_bad.i:14:3: warning: implicit declaration of function ‘memcpy’
[-Wimplicit-function-declaration]
   14 |   memcpy(0, h, 16);
      |   ^~~~~~
small_bad.i:14:3: warning: incompatible implicit declaration of built-in
function ‘memcpy’
small_bad.i:1:1: note: include ‘<string.h>’ or provide a declaration of
‘memcpy’
  +++ |+#include <string.h>
    1 | typedef a;
during RTL pass: reload
small_bad.i:15:1: internal compiler error: in curr_insn_transform, at
lra-constraints.c:4459
   15 | }
      | ^
0x6c44d9 curr_insn_transform
        /home/dimhen/src/gcc_current/gcc/lra-constraints.c:4459
0xe5c58e lra_constraints(bool)
        /home/dimhen/src/gcc_current/gcc/lra-constraints.c:4987
0xe47a24 lra(_IO_FILE*)
        /home/dimhen/src/gcc_current/gcc/lra.c:2468
0xdf89a9 do_reload
        /home/dimhen/src/gcc_current/gcc/ira.c:5522
0xdf89a9 execute
        /home/dimhen/src/gcc_current/gcc/ira.c:5706
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 small_bad.i 
typedef a;
d, e;
f() {
  a b, c, *g, i;
  char h[16];
  b = e;
  c = d;
  for (; i <= 0; i++) {
    *(h + 6) = *h;
    *(h + 8 + 4) = 0;
    *(g + (1 << h[1])) = *g << h[11] + j(0, 0, 0);
  }
  *(h + 8) = *(h + 8) ^ b ^ c;
  memcpy(0, h, 16);
}

Reply via email to