Description
This code prints random value at -O2/3
and 92 at -O0/1
:
int printf(const char *, ...);
int a, c, d, e;
int b[0];
int f() {
d = 7;
for (; 4 + d; d--)
e += 92 & 1 << d;
return e;
}
int main() {
int g = f();
printf("%d\n", g);
c = b[g];
}
Compiler Explorer: https://godbolt.org/z/9oa95vEjY
It starts from clang-13.