Issue 69293
Summary Wrong code at -O1/2/s on x86_64-linux_gnu since 669ddd1
Labels new issue
Assignees
Reporter shao-hua-li
    Clang at -O1/2/s produced the wrong code.

Bisected to 669ddd1e9b1226432b003dbba05b99f8e992285b, which was committed by @aeubanks 

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

```console
% cat a.c
int printf(const char *, ...);
long a;
int b, c, e, g, i;
long *d, *h;
char f = -26;
int main() {
  long j;
  c = 0;
  for (; c != 7; ++c) {
      long k=0;
      long l = k;
          long **m = &d;
      for (; f + i!=0; i++)
        h = &l;
          g = h != (*m = &j);
      int *n = &b;
          *n = g;
      for (; e;)
 for (; a; a = a + 1)
            ;
        }
 printf("%d\n", b);
}
%
% clang -O0 a.c && ./a.out
1
%
% clang -fsanitize=address,undefined a.c && ./a.out
1
% clang -fsanitize=memory a.c && ./a.out
1
% clang -O1 a.c && ./a.out
0
%
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to