-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation
Description
When I compiled this code with -O0/1/2, its output is 0. However, with -O3, it returned 143:
int printf(const char *, ...);
char a, b;
int c;
char *e = &b;
int f(char *g, int *k) {
char *d = g + *k;
for (; *d && *d <= ' '; d++)
;
if (*d)
return 0;
return 1;
}
int l(int g) {
char h[] = {a, a, a};
int i[] = {g};
int j = f(h, i);
return j;
}
long m() {
*e = 255;
for (; l(b + 1);)
return 0;
for (;;)
;
}
int main() {
m();
printf("%d\n", c);
}Details can be found here: https://godbolt.org/z/dnvvTPror
Metadata
Metadata
Assignees
Labels
llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation