https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117531
Bug ID: 117531
Summary: Miscompile with -O2 and -O0/1/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 -O2, it triggered SIGKILL. With -O0/1/3, it
returned 0:
```c
int a;
unsigned b;
char c = 228;
int f(int g) {
int d = g ? g - 1 : 1, e = 113 - d;
return e & 65535;
}
void h() {
for (; f(c + 115) + b > 40;)
for (;;)
;
}
int main() {
h();
}
```
Details can be found here: https://godbolt.org/z/fjG69eqoq