https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111764
Bug ID: 111764 Summary: Wrong code at -O3 on x86_64-linux-gnu since r11-5965-g04bff1bbfc1 Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: shaohua.li at inf dot ethz.ch CC: rguenth at gcc dot gnu.org Target Milestone: --- gcc at -O3 produced the wrong code. Bisected to r11-5965-g04bff1bbfc1 Compiler explorer: https://godbolt.org/z/7vaqadYfP $ cat a.c int printf(const char *, ...); char a; short b, c; static short *d = &b, *e = &b; short(f)(short g, short h) { return g * h; } int main() { *e = 2; a = 1; for (; a <= 9; a++) { short *i = &c; *i = *d = f(*e, *e); } printf("%d\n", c); } $ $ gcc -O0 a.c && ./a.out 0 $ gcc -O3 a.c && ./a.out 4 %