https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118918
Bug ID: 118918 Summary: Miscompile at -Os 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 triggers SIGFPE at -Os and prints 1 at -O0/1/2/3: ```c int printf(const char *, ...); int a, b; int c(int d, int h) { long *e; int f; if (h) e = (long[]){2}; else e = (long[]){2, 8}; f = 0; for (;; f++) { unsigned g = d / e[f]; if (g) return f; } } int i(int d, char *h) { if (b - 7 + b) return 1; return d + h[0]; } int j(char d) { int k = c(-70, 2), l = i(k, &d); a = 0; return l; } int main() { printf("%d", j(6)); } ``` Compiler Explorer: https://godbolt.org/z/3Tcjaq5Y6 It seems to start from gcc 10.2.