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

            Bug ID: 128690
           Summary: ICE on valid code at -O{2,3} with -fno-vect-cost-model
                    on x86_64-linux-gnu: in native_encode_rtx, at
                    simplify-rtx.cc:8266
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/nhvneYafx

Note:
- fails: trunk
- works: 16.2 and earlier

[508] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++,lto --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20261113 (experimental) [master r17-1628-gd1c12591336] (GCC) 
[509] % 
[509] % gcctk -c -O3 -fno-vect-cost-model small.c
small.c:37:1: internal compiler error: in native_encode_rtx, at
simplify-rtx.cc:8266
   37 | }
      | ^
0x27a159b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa7587b fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x8a2508 native_encode_rtx(machine_mode, rtx_def*, vec<unsigned char, va_heap,
vl_ptr>&, unsigned int, unsigned int)
        ../../gcc-trunk/gcc/simplify-rtx.cc:8266
0x168d8d3 optimize_constant_pool
        ../../gcc-trunk/gcc/varasm.cc:4705
0x16978cf output_shared_constant_pool()
        ../../gcc-trunk/gcc/varasm.cc:4812
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpbase small.c -dumpbase-ext .c -mtune=generic -march=x86-64
-O3 -fvect-cost-model=unlimited -o /tmp/ccR0UJ2V.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[510] % 
[510] % cat small.c
extern void g(int);
extern int h();
char a, b;
int d, e;
void f() {
  for (int c = 0; c < 8; ++c)
    a = 1;
}
void i(int j) {
  char k[8], l[8];
  k[0] = k[1] = k[2] = k[3] = k[4] = k[5] = k[6] = k[7] = 6;
  int *m = 0;
  char *n = 0;
  if (!d) {
    *m = 0;
    n = &b;
    goto p;
  }
  do {
    if (e)
      goto r;
  p:
    *n = 0;
    for (int s = 0; s < 8; ++s)
      l[s] = k[s];
  } while (b);
  l[6] = k[6] - 1;
  l[7] = k[7] - 1;
  if (j - h())
  r:
    f();
  k[6] = l[6];
  k[7] = 7 + l[7];
  g(k[6]);
  g(k[7]);
  g(l[7]);
}

Reply via email to