Issue 131465
Summary [clang] Miscompilation at -O2/3
Labels clang
Assignees
Reporter cardigan1008
    This code prints 80 at `-O2/3` and 0 at `-O0/1`:

```c
int printf(const char *, ...);
int a, b;
void c(char d) { a = d; }
int main() {
  int e = 82, f = 20;
  for (; 85 + 20 + e - 187 + f; f = 65535 + 20 + e - 65637)
    if (b)
      e++;
  c(e >> 24);
  printf("%X\n", a);
}
```

Compiler Explorer: https://godbolt.org/z/6WP1aT6ba

Bisected to https://github.com/llvm/llvm-project/commit/04cd06906288dcb148de37d7c3e6c009c3e3b726, which was committed by @preames 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to