Closed
Description
clang at -O3 produced the wrong code.
Bisected to 0d95b20, which was committed by @xortator
Compiler explorer: https://godbolt.org/z/o9Mdccsfe
% cat a.c
int printf(const char *, ...);
int a, b, c, d, e, g, h;
unsigned int f, i;
long j;
int k() {
if (f < 2)
return d;
g = e / f;
return g;
}
int main() {
i = -1;
for (; i>0; ++i) {
h = 0;
for (; h < 5; h++)
j = 1;
for (; k() + i + j <= 4; j++) {
while (c)
;
for (; b - 5 + h < 6;)
;
}
}
printf("%d\n", a);
}
%
% clang -O2 a.c && ./a.out
0
% clang -O3 a.c && ./a.out
floating point exception
% clang -fsanitize=address,undefined a.c && ./a.out
0
%