| Issue |
114578
|
| Summary |
[LoongArch] Miscompile with O2
|
| Labels |
miscompilation,
backend:loongarch
|
| Assignees |
dtcxzyw
|
| Reporter |
dtcxzyw
|
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: 8951b51402d17af1f97e5804f60c946e624650d6
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs