https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117528
Bug ID: 117528
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, its output is -167. However, with -O0/2/3,
its output is 89:
```c
int printf(const char *, ...);
int a;
long b;
char c, d = 166;
long *e = &b;
int main() {
int f;
for (; c <= 3; c++) {
f = c & a ? 0 : d - a;
*e = 255 ^ (f & 255U);
}
printf("%d\n", (int)b);
}
```
Details can be found here: https://godbolt.org/z/vT5rfqvYG