https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110369
Bug ID: 110369 Summary: wrong code on x86_64-linux-gnu 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. I'm unsure how interesting the test is as it uses a few non-default flags, but here it is. Compiler Explorer: https://godbolt.org/z/rvsrfzb1K [813] % 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 20230622 (experimental) [master r14-924-gd709841ae0f] (GCC) [814] % [814] % gcctk -O3 -fno-thread-jumps -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-split-loops -fno-tree-loop-ivcanon -fselective-scheduling2 -w small.c [815] % timeout -s 9 5 ./a.out Killed [816] % [816] % gcctk -O3 -w small.c; ./a.out [817] % [817] % cat small.c int printf(const char *, ...); int a, b[2] = {0, 0}, c; void d() { int e, f; for (f = 0; f < 2; f++) if (a) { for (e = 0; e < 5; e++) { printf("%d", b[e]); if (c) printf("\n"); } } } int main() { d(); }