-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
Description
% clang-tk -v
clang version 16.0.0 (https://github.com/llvm/llvm-project.git 0c1a3da8ea1f0e024ebfd85c7532926f26c6bde5)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /zdata/shaoli/compilers/ccbuilder-compilers
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
%
% clang-tk -w -O0 a.c && ./a.out
2
% clang-tk -w -O3 a.c && ./a.out
9
% cat a.c
void printf();
long a;
int b, d, e;
int *c;
void f(int *g) { *g = b; }
char h() {
long *i = &a;
for (;;) {
int j = 0;
for (;; a++) {
b = 2;
for (; b <= 8; b++) {
c = &j;
if (j)
break;
}
if (j)
break;
j = 1;
}
e = 3;
for (; e <= 8; e++) {
int k;
d = 3;
for (; d <= 8; d++) {
*i = k;
f(&k);
}
if (a)
return 0;
}
}
}
int main() {
h();
printf("%d\n", a);
}
%Compiler explorer: https://godbolt.org/z/WTce7z7Md
opt-bisect-limit indicates the issue maybe in IndVarSimplifyPass