| Issue |
115149
|
| Summary |
[clang] Miscompile with -O3 and -O0/1/2 since 18.1.0
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
cardigan1008
|
When I compiled this code with -O0/1/2, its output is 0. However, with -O3, it returned 143:
```c
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/MKW3535W6
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs