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

            Bug ID: 116990
           Summary: ICE on valid code at -O3 "-fno-tree-ccp
                    -fno-tree-loop-im -fno-tree-dse" on x86_64-linux-gnu:
                    in single_pred_edge, at basic-block.h:342
           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/GWej7xzKM


[526] % 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.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 15.0.0 20241006 (experimental) (GCC) 
[527] % 
[527] % gcctk -O3 -fno-tree-ccp -fno-tree-loop-im -fno-tree-dse -c small.c
during GIMPLE pass: vect
small.c: In function ‘main’:
small.c:3:5: internal compiler error: in single_pred_edge, at basic-block.h:342
    3 | int main() {
      |     ^~~~
0x25fd2a5 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xa7b60a fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1617
0x8f0f8d single_pred_edge(basic_block_def const*)
        ../../gcc-trunk/gcc/basic-block.h:342
0x8f0f8d single_pred(basic_block_def const*)
        ../../gcc-trunk/gcc/basic-block.h:361
0x8f0f8d vect_analyze_loop_form(loop*, vect_loop_form_info*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:1862
0x14d61ae vect_analyze_loop(loop*, vec_info_shared*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:3541
0x1523c03 try_vectorize_loop_1
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1070
0x1523c03 try_vectorize_loop
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1186
0x15244dc execute
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1302
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.
[528] % 
[528] % cat small.c
extern void f();
int a, b, c, d;
int main() {
  int e, *g;
  if (a)
    while (1) {
      g = &c;
      if (a)
        f();
      for (b = 2; b; b--)
        g = &e;
      if (g == &e)
        if (a && d)
          return 0;
      e = 0;
    }
  return 0;
}

Reply via email to