-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation
Description
Reproducer:
int printf(const char *, ...);
int a;
long b = 1;
short c, d;
void e(short f) {
ab:
d = f == b ?1: b % f;
if (d)
c = 0;
for (; c <= 0; c++) {
if (c)
goto ab;
a++;
}
}
void g() {
short h = 15;
for (; h; --h) {
e(h);
e(11);
}
}
int main() {
g();
printf("%d\n", a);
}
> gcc -O0 test.c && ./a.out
30
> clang -O3 test.c && ./a.out
29
llvm version: 8951b51
Metadata
Metadata
Assignees
Labels
llvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingllvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation