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

            Bug ID: 121768
           Summary: ICE on valid code at -O{2,3} with "-fno-tree-dce
                    -fno-inline" on x86_64-linux-gnu: in
                    vect_build_slp_tree_2, at tree-vect-slp.cc:3217
           Product: gcc
           Version: unknown
            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/3K9joeMqf

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

[660] % 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/16.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++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250902 (experimental) (GCC)
[661] %
[661] % gcctk -O2 -fno-tree-dce -fno-inline small.c
during GIMPLE pass: vect
small.c: In function ‘main’:
small.c:3:5: internal compiler error: in vect_build_slp_tree_2, at
tree-vect-slp.cc:3217
    3 | int main () {
      |     ^~~~
0x255c04b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:786
0xa08bbc fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1787
0x14e478b vect_build_slp_tree_2
        ../../gcc-trunk/gcc/tree-vect-slp.cc:3217
0x14e642c vect_build_slp_tree
        ../../gcc-trunk/gcc/tree-vect-slp.cc:1867
0x14e9981 vect_build_slp_instance
        ../../gcc-trunk/gcc/tree-vect-slp.cc:4100
0x14edc7f vect_analyze_slp(vec_info*, unsigned int, bool)
        ../../gcc-trunk/gcc/tree-vect-slp.cc:5360
0x14af68b vect_analyze_loop_2
        ../../gcc-trunk/gcc/tree-vect-loop.cc:2340
0x14b0a6b vect_analyze_loop_1
        ../../gcc-trunk/gcc/tree-vect-loop.cc:2900
0x14b1261 vect_analyze_loop(loop*, gimple*, vec_info_shared*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:3079
0x1508bfc try_vectorize_loop_1
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1096
0x1508bfc try_vectorize_loop
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1215
0x150954c execute
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1331
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.
[662] %
[662] % cat small.c
int a, b, c;
char d(char p) { return p; }
int main () {
  while (c) {
    for (b = 2; b; b--) {
      int *g = &a;
      *g = d((d(*g) >= 128) | b);
    }
    c--;
  }
  return 0;
}

Reply via email to