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

            Bug ID: 119057
           Summary: ICE at -O{2,3} with "-fno-tree-vrp -fno-tree-forwprop"
                    on x86_64-linux-gnu: in operator[], at vec.h:910
           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: ---

It appears to be a recent regression as it doesn't reproduce with 14.2 and
earlier. 

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

[536] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.1/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 15.0.1 20250228 (experimental) (GCC) 
[537] % 
[537] % gcctk -O2 -fno-tree-vrp -fno-tree-forwprop small.c
during GIMPLE pass: vect
small.c: In function ‘main’:
small.c:10:5: internal compiler error: in operator[], at vec.h:910
   10 | int main() {
      |     ^~~~
0x26db5e6 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xac3f94 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1722
0x929272 vec<simd_call_arg_info, va_heap, vl_embed>::operator[](unsigned int)
        ../../gcc-trunk/gcc/vec.h:910
0x929272 vec<simd_call_arg_info, va_heap, vl_ptr>::operator[](unsigned int)
        ../../gcc-trunk/gcc/vec.h:1599
0x92abcb vec<_slp_tree*, va_heap, vl_ptr>::operator[](unsigned int)
        ../../gcc-trunk/gcc/tree.h:3888
0x92abcb vect_is_simple_use(vec_info*, _stmt_vec_info*, _slp_tree*, unsigned
int, tree_node**, _slp_tree**, vect_def_type*, tree_node**, _stmt_vec_info**)
        ../../gcc-trunk/gcc/tree-vect-stmts.cc:14598
0x156502b vectorizable_reduction(_loop_vec_info*, _stmt_vec_info*, _slp_tree*,
_slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:8029
0x153e4f2 vect_analyze_stmt(vec_info*, _stmt_vec_info*, bool*, _slp_tree*,
_slp_instance*, vec<stmt_info_for_cost, va_heap, vl_ptr>*)
        ../../gcc-trunk/gcc/tree-vect-stmts.cc:13885
0x15a36ad vect_slp_analyze_node_operations_1
        ../../gcc-trunk/gcc/tree-vect-slp.cc:7811
0x15a36ad vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8030
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a35c2 vect_slp_analyze_node_operations
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8007
0x15a561f vect_slp_analyze_operations(vec_info*)
        ../../gcc-trunk/gcc/tree-vect-slp.cc:8437
0x1569e77 vect_analyze_loop_2
        ../../gcc-trunk/gcc/tree-vect-loop.cc:2994
0x156bc95 vect_analyze_loop_1
        ../../gcc-trunk/gcc/tree-vect-loop.cc:3484
0x156c470 vect_analyze_loop(loop*, gimple*, vec_info_shared*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:3644
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.
[538] % 
[538] % cat small.c
int a, b, c, d;
unsigned e;
void f() {
  unsigned h;
  for (d = 0; d < 2; d++)
    b |= e;
  h = b;
  c |= h;
}
int main() {
  for (; a; a++)
    f();
  return 0;
}

Reply via email to