[Bug tree-optimization/126852] New: ICE on valid code at -O3 with "-mavx2 -fno-vect-cost-model -fno-tree-pre" on x86_64-linux-gnu: verify_ssa failed

"zhendong.su at inf dot ethz.ch via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126852

            Bug ID: 126852
           Summary: ICE on valid code at -O3 with "-mavx2
                    -fno-vect-cost-model -fno-tree-pre" on
                    x86_64-linux-gnu: verify_ssa failed
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/4ePjrKd6n

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

[723] % 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 20260813 (experimental) [master r17-1628-gd1c12591336] (GCC) 
[724] % 
[724] % gcctk -O3 -c -mavx2 -fno-vect-cost-model -fno-tree-pre small.c
small.c: In function ‘e’:
small.c:7:6: error: definition in block 6 does not dominate use in block 12
    7 | void e(char f, char g, long h, long i) {
      |      ^
for SSA_NAME: _57 in statement:
vect__29.12_58 = PHI <_57(12)>
PHI argument
_57
for PHI node
vect__29.12_58 = PHI <_57(12)>
during GIMPLE pass: slp
small.c:7:6: internal compiler error: verify_ssa failed
0x27cea3b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x14adbff verify_ssa(bool, bool)
        ../../gcc-trunk/gcc/tree-ssa.cc:1226
0x10c52d4 execute_function_todo
        ../../gcc-trunk/gcc/passes.cc:2107
0x10c5a2e execute_todo
        ../../gcc-trunk/gcc/passes.cc:2152
/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 -mavx2 -mtune=generic
-march=x86-64 -O3 -fvect-cost-model=unlimited -fno-tree-pre -o /tmp/ccxKBQfl.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.
[725] % 
[725] % cat small.c
int a;
long b, c;
__attribute__((noinline)) int d() {
  a = 0;
  return 0;
}
void e(char f, char g, long h, long i) {
  char j;
k:
  do {
    j = 2 * f;
    if (!g)
      return;
    d();
    if (g << g)
      goto k;
    unsigned long m = b;
    long n = m >> 8;
    c = n + 2088470516281635866 * i + h * h + 7017580219 * i;
  } while (j < f + 2);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.