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

            Bug ID: 110600
           Summary: ICE on valid code at -O1 and above 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 recent regression.

[546] % 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/14.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 14.0.0 20230708 (experimental) [master r14-924-gd709841ae0f] (GCC) 
[547] % 
[547] % gcctk -O1 small.c
during GIMPLE pass: cunroll
small.c: In function ‘main’:
small.c:2:5: internal compiler error: Segmentation fault
    2 | int main() {
      |     ^~~~
0xfe4473 crash_signal
        ../../gcc-trunk/gcc/toplev.cc:314
0x7fa025ede51f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fa025f1bfc2 __GI__IO_fwrite
        ./libio/iofwrite.c:37
0xad5839 fprintf
        /usr/include/x86_64-linux-gnu/bits/stdio2.h:105
0xad5839 scale_loop_profile(loop*, profile_probability, long)
        ../../gcc-trunk/gcc/cfgloopmanip.cc:585
0x11469b5 try_unroll_loop_completely
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:911
0x11469b5 canonicalize_loop_induction_variables
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1286
0x1147d82 tree_unroll_loops_completely_1
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1429
0x1147cea tree_unroll_loops_completely_1
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1382
0x1148134 tree_unroll_loops_completely
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1478
0x1148403 execute
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1644
0x1148403 execute
        ../../gcc-trunk/gcc/tree-ssa-loop-ivcanon.cc:1634
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.
[548] % 
[548] % cat small.c
int a(int b, int c) { return (b ^ c) < 0 ? b : b - c; }
int main() {
  for (int e = 0; e != -1; e = a(e, 1))
    ;
  return 0;
}

Reply via email to