[Bug tree-optimization/126862] New: [17 Regression] ICE: verify_ssa failed for PHI node during GIMPLE pass: slp with -O3 -ftree-slp-vectorize -fvect-cost-model=unlimited

bouncy12578 at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126862

            Bug ID: 126862
           Summary: [17 Regression] ICE: verify_ssa failed for PHI node
                    during GIMPLE pass: slp with -O3 -ftree-slp-vectorize
                    -fvect-cost-model=unlimited
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bouncy12578 at gmail dot com
  Target Milestone: ---

Created attachment 65332
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65332&action=edit
preprocessed crash.c

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

When compiling a CSmith generated file with GCC 17.0.0 (x86_64-pc-linux-gnu), I
hit an Internal Compiler Error (verify_ssa failed) during the SLP vectorization
pass under unlimited model.


Compiler version: 

Using built-in specs.
COLLECT_GCC=/data/lenovo/compiler-build/gcc/gcc-install/bin/gcc
COLLECT_LTO_WRAPPER=/data/lenovo/compiler-build/gcc/gcc-install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure
--prefix=/data/lenovo/compiler-build/gcc/gcc-install --disable-bootstrap
--enable-languages=c,c++ --disable-multilib --with-isl --enable-checking=all :
(reconfigured) ../gcc/configure
--prefix=/data/lenovo/compiler-build/gcc/gcc-install --disable-bootstrap
--enable-languages=c,c++ --disable-multilib --with-isl --enable-checking=all
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260812 (experimental) (GCC)

Stack trace: 

gcc crash.c -O3 -ftree-slp-vectorize -fvect-cost-model=unlimited -freport-bug

crash.c: In function ‘f’:
crash.c:14:10: error: definition in block 25 does not dominate use in block 24
   14 | uint32_t f() {
      |          ^
for SSA_NAME: _38 in statement:
d_lsm.5_52 = PHI <0(21), _38(24)>
PHI argument
_38
for PHI node
d_lsm.5_52 = PHI <0(21), _38(24)>
during GIMPLE pass: slp
crash.c:14:10: internal compiler error: verify_ssa failed
0x2f1e2eb internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:787
0x196ee8f verify_ssa(bool, bool)
        ../../gcc/gcc/tree-ssa.cc:1226
0x1565cc4 execute_function_todo
        ../../gcc/gcc/passes.cc:2107
0x156641e execute_todo
        ../../gcc/gcc/passes.cc:2152
/data/lenovo/compiler-build/gcc/gcc-install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu crash.c -quiet -dumpdir a- -dumpbase
crash.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -ftree-slp-vectorize
-fvect-cost-model=unlimited -freport-bug -o /tmp/cc7nMfe3.s
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/cc7qnOks.out file, please attach this to
your bugreport.

crash.c

#include <stdint.h>
static uint16_t
(safe_mod_func_uint16_t_u_u)(uint16_t ui1, uint16_t ui2 ){
  return
    (ui2 == 0) ?
    ((ui1)) :
    (ui1 % ui2);
}
struct a {};
int32_t b[4][5];
int16_t c[5];
uint16_t d;
int32_t *e(struct a, uint16_t, uint32_t, int32_t *, int64_t);
uint32_t f() {
  int32_t g[4][5];
  for (b[3][3] = 0; b[3][3] <= 3; b[3][3]++) {
    struct a h;
    e(h, 0, g[2][4], &b[3][3], b[9][4]);
  }
}
int32_t *e(struct a, uint16_t, uint32_t, int32_t *k, int64_t) {
  int32_t i[4];
  uint16_t *j = &d;
  if (c[4] ^= safe_mod_func_uint16_t_u_u(++*j, 0), *i)
    *j = 0;
  return k;
}
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.