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

            Bug ID: 122969
           Summary: ICE on valid code at -O3 with
                    "-fno-tree-dominator-opts -fno-code-hoisting
                    -fno-tree-pre -fno-tree-dce" on x86_64-linux-gnu: in
                    first_imm_use_stmt, at ssa-iterators.h:972
           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/TzeznYsYK

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


[515] % 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 20251201 (experimental) (GCC) 
[516] % 
[516] % gcctk -O3 small.c; ./a.out
[517] % gcctk -O3 -fno-tree-dominator-opts -fno-code-hoisting -fno-tree-pre
-fno-tree-dce small.c
small.c: In function ‘main’:
small.c:4:26: warning: iteration 2147483648 invokes undefined behavior
[-Waggressive-loop-optimizations]
    4 |     for (a = 0; a != 1; a--)
      |                         ~^~
small.c:4:19: note: within this loop
    4 |     for (a = 0; a != 1; a--)
      |                 ~~^~~~
during GIMPLE pass: vect
small.c:2:5: internal compiler error: in first_imm_use_stmt, at
ssa-iterators.h:972
    2 | int main() {
      |     ^~~~
0x25bd21b internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa18210 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1805
0x915c41 first_imm_use_stmt(imm_use_iterator*, tree_node*)
        ../../gcc-trunk/gcc/ssa-iterators.h:972
0x915c41 vect_update_ivs_after_vectorizer
        ../../gcc-trunk/gcc/tree-vect-loop-manip.cc:2442
0x14ee2fd vect_do_peeling(_loop_vec_info*, tree_node*, tree_node*, tree_node**,
tree_node**, tree_node**, int, bool, bool, tree_node**)
        ../../gcc-trunk/gcc/tree-vect-loop-manip.cc:3673
0x14c8efc vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:11138
0x152d5fb vect_transform_loops
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1037
0x152dce3 try_vectorize_loop_1
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1186
0x152dce3 try_vectorize_loop
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1216
0x152e37c execute
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1333
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.
[518] % 
[518] % cat small.c
int a, b;
int main() {
  while (a)
    for (a = 0; a != 1; a--)
      if (b)
        break;
  return 0;
}

Reply via email to