Description
This code prints 15 at -O3, but prints 5 at -O0/1/2:
int printf(const char *, ...);
static int a[] = {4294967295, 5};
int b, c;
int main() {
a[1] = b = 5;
unsigned d = -13;
for (; d >= 8; d = a[0] + d + 6) {
int *e = &b;
*e = a[0] - -1 + b;
}
a[c];
printf("%d\n", b);
}
Compiler Explorer: https://godbolt.org/z/4xdPqcjPb
Metadata
Metadata
Assignees
Type
Projects
Status