https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118064
Bug ID: 118064 Summary: Miscompilation at -O1 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 prints 1 at -O1 and 0 at -O0/2/3: ```c int printf(const char *, ...); short a; int b; int *const c = &b; static int *d = &b; long e = 1; char(f)(char g, char h) { return g - h; } int main() { int *i = &b; for (; a != 2; ++a) { *c ^= 1; if (*d) ; else { *c = f(*i, 1) || *i; if (*c) e = 0; } } printf("%d\n", (int)e); } ``` Compiler Explorer: https://godbolt.org/z/K3fEfnd8o Bisected to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e8febb641415fd80eabce1c4fdf2d4a4b411213b