https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117549
Bug ID: 117549
Summary: Miscompile with -O0 and -O1/2/3
Product: gcc
Version: 6.5.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 -O0, it triggered SIGKILL. With -O1/2/3, it
returned 0:
```c
int printf(const char *, ...);
int a, b = -2, e, f, g;
char c = 194;
short d = 60090;
short *h = &d;
void j(short k, short l) {}
int *m() {
int n[1];
int i = 0;
for (; b + c + *h - -5509 + i < 1; i++)
n[i] = g;
return &e;
}
int main() {
j(d = 3, &f != m());
printf("%X\n", a);
}
```
The earliest version of this bug is x86_64 gcc 6.5.0.
Details can be found here: https://godbolt.org/z/4s57n65hM