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

            Bug ID: 116982
           Summary: ICE on valid code at -O3 with "-fno-tree-dce
                    -fno-tree-dominator-opts -fno-tree-pre -fno-tree-dse
                    -fno-tree-copy-prop -fno-tree-fre -fno-code-hoisting"
                    on x86_64-linux-gnu: Segmentation fault
           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: ---

This appears to be a regression from 13.* and affects 14.* and later.

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

[580] % 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 20241004 (experimental) (GCC) 
[581] % 
[581] % gcctk -O3 -fno-tree-dce -fno-tree-dominator-opts -fno-tree-pre
-fno-tree-dse -fno-tree-copy-prop -fno-tree-fre -fno-code-hoisting small.c
during GIMPLE pass: vect
small.c: In function ‘main’:
small.c:5:5: internal compiler error: Segmentation fault
    5 | int main() {
      |     ^~~~
0x25fcfb5 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0x11c9703 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:321
0x7f60134e708f ???
       
/build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x14d7a31 vect_transform_loop(_loop_vec_info*, gimple*)
        ../../gcc-trunk/gcc/tree-vect-loop.cc:12418
0x152367e vect_transform_loops
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1010
0x1523d83 try_vectorize_loop_1
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1156
0x1523d83 try_vectorize_loop
        ../../gcc-trunk/gcc/tree-vectorizer.cc:1186
0x15243bc 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.
[582] % 
[582] % cat small.c
struct a {
  int b : 1;
};
int c, d;
int main() {
  while (c)
    for (; d; d++) {
      struct a f = {1};
      c = 0;
      while (c)
        ;
    }
  return 0;
}

Reply via email to