https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117543
Bug ID: 117543 Summary: Miscompile with -O1 and -O0/2/3 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: --- When I compiled this code with -O1, it triggered SIGFPE. With -O0/2/3, it returned 0: ```c int printf(const char *, ...); int a, b = 422; char c; char(d)(unsigned char e, unsigned char f) { return e / f; } short(i)(short e, short f) { return e - f; } int j() { int g, h = 0; for (; h < 1; ++h) g = h; return g; } int main() { int k; short l = i(~0, b); k = j(); c = d(l, k + 1); printf("%X\n", a); } ``` Details can be found here: https://godbolt.org/z/zhM5P41er I have checked with the recent problematic commit. It works fine on that.