https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101972
Bug ID: 101972 Summary: wrong code at -O2 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 regression in gcc-9. gcc-8 works fine. $ gcc-trunk -O2 abc.c ; ./a.out 0 $ gcc-trunk abc.c ; ./a.out 30 $ gcc-8 -O2 abc.c ; ./a.out 30 $ cat abc.c int a, b, c, d, f; static short e = 63891; char g = 30; unsigned h(i, j) { return i << j; } int *l(int *); void m() { a = 0; for (; a >= 0; a--) { int *k = &b; *k = e < 0; } c = b; l(&c); } int *l(int *i) { d = 2; for (; d <= 6; d++) { if (h(d, *i) <= d) ; else continue; g = 0; return &f; } } int main() { m(); printf("%d\n", g); }