https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118954
Bug ID: 118954 Summary: Miscompile at -O3 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: yunboni at smail dot nju.edu.cn Target Milestone: --- This code times out at -O3 and prints 0 at -O0/1/2/s: int printf(const char *, ...); int a, b, c, d; void e(int f) { int g[] = {5, 8}; int *h = g; while (c < f) { d = 0; for (; d < f; d++) c = h[d]; } } int main() { int i = (0 == a + 1) - 1; e(i + 3); printf("%X\n", b); } Compiler Explorer: https://godbolt.org/z/T3e7rME61 It appears to be a recent regression, as it cannot be reproduced with GCC 14.2 or earlier.