https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118148
Bug ID: 118148 Summary: Miscompilation 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 prints 256 at -Os and 0 at -O0/1/2/3: ```c int printf(const char *, ...); short a; int b; short *c = &a; static int(d)(int e, unsigned f) { return e < 0 || f ? e : 0; } static char g(long e, unsigned char f) { f++; b = d(f, e); *c = b; return 0; } int main() { g(4073709551609, 255); printf("%d\n", a); } ``` Bisected to: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=96fb71883d438bdb241fdf9c7d12f945c5ba0c7f Compiler Explorer: https://godbolt.org/z/3d8bWv9Kc