https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103440
Bug ID: 103440 Summary: wrong code at -Os and above 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 seems to be recent and a regression from GCC 11.2. [671] % 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/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++ --disable-werror --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20211126 (experimental) [master r12-4647-g3f861a5c8fd] (GCC) [672] % [672] % gcctk -O1 small.c; ./a.out [673] % [673] % gcctk -Os small.c [674] % timeout -s 9 10 ./a.out Killed [675] % [675] % cat small.c int a, b, c, d, e; int main() { int f = 2, g = 1, h = -3; L1: c = b ^ 1; if (!f) goto L3; if (d) g = e; f = h; if (!c) goto L1; L2: if (g) a = 0; L3: if (d == g) goto L2; return 0; }