https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117453
Bug ID: 117453 Summary: Miscompile with -O3 and -O0/1/2 Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: yunboni at smail dot nju.edu.cn Target Milestone: --- When compiled with -O0/1/2, its output is 0. With -O3, it's 4. It can be fixed with -fstack-reuse=none. ```c int printf(const char *, ...); int a[6]; int b, j, o; char c; char d[11]; char *e; short f, g; short *h = &f; int main() { char l[7]; int i = 0; for (; i < 7; i++) { { char n[10]; int k = 15; char *m = n; e = d; while (k) *e++ = k /= 10; while (e != d) *m++ = *--e; *m++ = '\0'; j = m - n - 1; } l[j] = 4; } g = l[2]; *h = g; printf("%d\n", f); for (; b; o++) { b = c; if (c) b = a[b]; } } ``` Details can be found here: https://godbolt.org/z/Pqzr9rbno