Issue 64669
Summary Wrong code at -O1 and above on x86_64-linux_gnu since f12a556
Labels new issue
Assignees
Reporter shao-hua-li
    This is a recent regression. Clang at -O1 and above produced the wrong code.

Bisected to f12a5561b2cbfae384c9a31293938ee2acea79fd, which was committed by @antoniofrighetto 

Compiler explorer: https://godbolt.org/z/q4fsW5Ge7

```console
% cat a.c 
int printf(const char *, ...);
long a, e;
int b[72];
int c, g, h;
char d;
int main() {
  int *f = &b[25], *i = &c;
  d = f != i;
  e = a * d;
  *f = e + d;
  printf("%d\n", b[25]);
}
%
% clang-f12a556 -O0 a.c && ./a.out
1
% clang-f12a556 -O1 a.c && ./a.out
-1
% clang-f12a556 -O2 a.c && ./a.out
-1
%
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to