https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110370
Bug ID: 110370 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: --- Similar to PR 110369, this test also uses a number of non-default flags. It is a regression from 10.*, and affects 11.* and later. Compiler Explorer: https://godbolt.org/z/d1T6vh7sf [782] % 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) [783] % [783] % gcctk -O2 -fno-tree-copy-prop -fira-loop-pressure -ftracer -fno-tree-vrp -fno-tree-forwprop -fno-tree-ccp -fno-code-hoisting -fno-gcse -fno-tree-dominator-opts -fno-tree-fre -fno-tree-pre -fsel-sched-pipelining -fno-tree-ter -fschedule-insns -fselective-scheduling2 small.c [784] % ./a.out Floating point exception [785] % [785] % gcctk -O2 small.c; ./a.out [786] % [786] % cat small.c int printf(const char *, ...); int a; long b; short c = 1; unsigned long d = 5; int main() { short f = 1; int g, i = 0; unsigned h = 3, j = 1; for (; i < 4; i++) { int k, m = c * (f % d); long l = f & d; if (d || !j || g) { k = g = l % h | b; b = (j < b) & (f > k); if (!m) printf("%d", g); if (!c) printf("%d", a); } g = k; b = l; a = m; } return 0; }