Closed as not planned
Description
Compiler explorer: https://godbolt.org/z/PP5eaEccb
Clang-18 produces the wrong code when compiling the following code with "-O1" or "-O2", while outputting the correct result with the optimization flag "-O3".
int printf(const char *, ...);
long a;
int b, c, e, g, i;
long *d, *h;
char f = 6;
int main() {
long j;
c = 0;
for (; c != 7; ++c) {
long k;
long **l = &d;
for (; f + i; i++)
h = &k;
g = h != (*l = &j);
int *m = &b;
*m = g;
for (; e; a = a + 1)
;
}
printf("%d\n", b);
}
clang -O2 s.c; ./a.out
0
clang -O3 s.c; ./a.out
1
gcc -O2 s.c; ./a.out
1