https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110317
Bug ID: 110317 Summary: ICE at -O2 and -O3 with "-fno-tree-pre -fno-tree-dce -fno-tree-dse -fselective-scheduling2": in move_exprs_to_boundary, at sel-sched.cc:5228 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-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 11.*, and affects 12.* and later. Compiler Explorer: https://godbolt.org/z/Y893oebTc [511] % 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 --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230620 (experimental) [master r14-924-gd709841ae0f] (GCC) [512] % [512] % gcctk -O2 -fno-tree-pre -fno-tree-dce -fno-tree-dse -fselective-scheduling2 small.c during RTL pass: sched2 small.c: In function ‘main’: small.c:19:1: internal compiler error: in move_exprs_to_boundary, at sel-sched.cc:5228 19 | } | ^ 0x7ce44c move_exprs_to_boundary ../../gcc-trunk/gcc/sel-sched.cc:5228 0x7ce44c schedule_expr_on_boundary ../../gcc-trunk/gcc/sel-sched.cc:5436 0xf7f03f fill_insns ../../gcc-trunk/gcc/sel-sched.cc:5578 0xf7f03f schedule_on_fences ../../gcc-trunk/gcc/sel-sched.cc:7353 0xf7f03f sel_sched_region_2 ../../gcc-trunk/gcc/sel-sched.cc:7491 0xf81258 sel_sched_region_1 ../../gcc-trunk/gcc/sel-sched.cc:7533 0xf82876 sel_sched_region(int) ../../gcc-trunk/gcc/sel-sched.cc:7634 0xf82876 sel_sched_region(int) ../../gcc-trunk/gcc/sel-sched.cc:7619 0xf82a19 run_selective_scheduling() ../../gcc-trunk/gcc/sel-sched.cc:7720 0xf6412d rest_of_handle_sched2 ../../gcc-trunk/gcc/sched-rgn.cc:3743 0xf6412d execute ../../gcc-trunk/gcc/sched-rgn.cc:3890 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, c, d, e, f; char b; extern int l(int p); int main() { int h, i; if (a) while (1) { int j = 6 / a * b, k = j || 6 ^ e; k = h; h = d || b; i = (6 / a + ~f + i) >> -c; if (!b) l(h); if (d) l(i); i = 6; } return 0; }