Issue |
128528
|
Summary |
[clang] Miscompilation at -O2/3
|
Labels |
clang
|
Assignees |
|
Reporter |
cardigan1008
|
This code prints 3333 at -O0/1 and -2147483648 at -O2/3:
```c
int printf(const char *, ...);
int a, b, c;
long double d;
int f(int g, int i) {
int e = g + i;
e++;
return e;
}
int j() {
int h = -1;
if (b)
return h;
return 0;
}
void k(int g) { a = -66 + g - 38; }
int main() {
int l, m = j();
l = f(m + 34, m + 80) + m - 112 + m;
k(l + 38 - 37 + 38);
d = 4 + a - -66;
a = c = d * 4.16666666666666666019e02;
printf("%d\n", c);
}
```
Compiler Explorer: https://godbolt.org/z/TnK1bWcGd
Bisected to https://github.com/llvm/llvm-project/commit/15a7de697ae5ad88fd96ef7dc39ac479cc6e2eaf, which was committed by @goldsteinn
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs