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

            Bug ID: 116747
           Summary: ICE on valid code at -O3 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: ---

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

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

[511] % 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 20240917 (experimental) (GCC) 
[512] % 
[512] % gcctk -O3 small.c
during GIMPLE pass: cselim
small.c: In function ‘main’:
small.c:2:5: internal compiler error: Segmentation fault
    2 | int main() {
      |     ^~~~
0x25acc85 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0x11bd043 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:321
0x7f49c67ed08f ???
       
/build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0xdf141b gsi_for_stmt(gimple*)
        ../../gcc-trunk/gcc/gimple-iterator.cc:616
0x139e6a1 cond_if_else_store_replacement_1
        ../../gcc-trunk/gcc/tree-ssa-phiopt.cc:3479
0x13a512c cond_if_else_store_replacement
        ../../gcc-trunk/gcc/tree-ssa-phiopt.cc:3734
0x13a512c operator()
        ../../gcc-trunk/gcc/tree-ssa-phiopt.cc:4463
0x13a512c execute_over_cond_phis<(anonymous
namespace)::pass_cselim::execute(function*)::<lambda(basic_block, basic_block,
basic_block, edge, edge, bool, gcond*)> >
        ../../gcc-trunk/gcc/tree-ssa-phiopt.cc:4016
0x13a512c execute
        ../../gcc-trunk/gcc/tree-ssa-phiopt.cc:4483
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.
[513] % 
[513] % cat small.c
int a, b, c, d[1], e, f[8], g, h;
int main() {
  int j, k[8], i = 0;
  for (; i < 1; i++)
    g = 1;
  while (c) {
    while (e < 1)
      ;
    j = 1;
    for (; j < 8; j++) {
      h = a ? a : b;
      c = h || (k[8] = g || (f[e] = k[8])) < 0;
      d[e] = 1 & f[e + 1];
    }
  }
  return 0;
}

Reply via email to