https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115671
Bug ID: 115671 Summary: wrong code at -O1 with "-fgcse -fno-inline -fschedule-insns" on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- It seems to be a recent regression as it doesn't reproduce with 14.1. Compiler Explorer: https://godbolt.org/z/Ev6hsWhE1 [648] % 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 20240626 (experimental) (GCC) [649] % [649] % gcctk -O1 small.c; ./a.out [650] % [650] % gcctk -O1 -fgcse -fno-inline -fschedule-insns small.c [651] % ./a.out Aborted [652] % [652] % cat small.c int printf(const char *, ...); int a, b, c, d, e; short f[2]; int g(int h, int i) { return 0; } int j(int h, int i) { return i; } void k() { int l; for (; b < 1; b++) { l = g(a, e); c = l < a; e = j(f[1 + b], 2); d = a || d; if (j(0, 1)) return; } } int main() { k(); if (c != 0) __builtin_abort(); return 0; }