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

            Bug ID: 116380
           Summary: ICE on valid code at -O3 with "-fno-tree-scev-cprop"
                    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 regression from 12.*, and affects 13.* and later. 

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


[516] % 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 20240815 (experimental) (GCC) 
[517] % 
[517] % gcctk -O3 -fno-tree-scev-cprop small.c
during GIMPLE pass: ldist
small.c: In function ‘main’:
small.c:2:5: internal compiler error: Segmentation fault
    2 | int main() {
      |     ^~~~
0x2505c05 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:491
0x119da33 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:321
0x7f1ecfbec08f ???
       
/build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x13358d1 find_uses_to_rename_use
        ../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:414
0x13358d1 find_uses_to_rename_bb
        ../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:489
0x133742d find_uses_to_rename
        ../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:521
0x133742d rewrite_into_loop_closed_ssa_1
        ../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:588
0x133742d rewrite_into_loop_closed_ssa(bitmap_head*, unsigned int)
        ../../gcc-trunk/gcc/tree-ssa-loop-manip.cc:628
0x124c35f loop_distribution::execute(function*)
        ../../gcc-trunk/gcc/tree-loop-distribution.cc:3969
0x124c82f execute
        ../../gcc-trunk/gcc/tree-loop-distribution.cc:4016
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[3], b, c, d[3], e;
int main() {
  for (; e < 3; e++) {
    a[0] = 0;
    b && (c = b);
    d[e] = 0;
    a[e] = 0;
  }
  return 0;
}

Reply via email to