https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117532
Bug ID: 117532 Summary: Miscompile with -Os and -O0/1/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 -Os, its output is -256. But with -O0/1/2/3, its output is 0: ```c int printf(const char *, ...); int a, c = -1; int main() { a = ~c; printf("%d\n", (unsigned char)a); } ``` Details can be found here: https://godbolt.org/z/o77dorWzr