https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119053
Bug ID: 119053
Summary: Miscompile at -O2/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: ---
This code times out at -O2/3 and prints out 0 at -O0/1/s:
int a = 4;
int printf(const char *, ...);
int b;
int c;
void d(int e) {
int f = 0;
while (!f + a - 4) {
f = e == 0;
e = f ? 1 : e;
}
}
int g;
int main() {
int crc = 8;
for (; g; )
crc = 0;
c = crc;
d(1 - 1);
printf("%X\n", b);
}
Compiler Explorer: https://godbolt.org/z/8qvf16fP4
Bisected to
https://github.com/gcc-mirror/gcc/commit/bed6ec161be8c5ca2f24195900ce3c9b81c3e141