https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101025
Bug ID: 101025 Summary: wrong code at -O3 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: qrzhang at gatech dot edu Target Milestone: --- It appears to be a recent regression. Bisection points to g:128f43cf679e51564202b41f23fae4146347f93d $ gcc-trunk -v Supported LTO compression algorithms: zlib gcc version 12.0.0 20210610 (experimental) [master revision 5ad76ad7f5b:c64ab1c4fe0:cce1697e6fe0134616ebc8f7040d99e66c12241a] (GCC) $ gcc-trunk abc.c ; ./a.out 0 $ gcc-trunk -O3 abc.c ; ./a.out 4 $ cat abc.c int a[10]; int b, d, g; volatile char c; short e; volatile int f; int main() { for (; d <= 9; d++) { b = e = 0; for (; e < 10; e++) a[e] = 4; for (; b <= 9; b++) if (g) f = 0; else a[b] = c; } printf("%d\n", a[1]); }