-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
Description
It appears to be a recent regression as it doesn't reproduce with 18.1.0 and earlier.
Compiler Explorer: https://godbolt.org/z/fzsqjEPWW
[562] % clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 52139d8f9a4e3f595ca552393d62ba06b0bc082c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
[563] %
[563] % clangtk -O2 -w small.c
[564] % ./a.out
0
[565] % clangtk -O3 -w small.c
[566] % ./a.out
[567] %
[567] % cat small.c
int printf(const char *, ...);
int a, b, e, g;
volatile int c;
static int d[1] = {1}, f;
int h() {
for (b = 0; b < 4; b++) {
for (e = 0; e < 4; e++)
while (b) {
if (c > 0 && d[1])
break;
return f;
}
}
return 0;
}
void i() {
int *j[1];
j[g] = &d[0];
}
int main() {
h();
printf("%d\n", a);
return 0;
}
dtcxzyw