Issue 71330
Summary Wrong code at -O3 on x86_64-linux_gnu since 0289dad (recent regression)
Labels new issue
Assignees
Reporter shao-hua-li
    clang at -O3 produces the wrong code.

Bisected to 0289dad538fa2fdc1a82a26f5d19f94fbd20d949, which was committed by @goldsteinn 

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

```console
% cat a.c
int printf(const char *, ...);
char a, e = 5, g, k, l;
short b, n;
int m, o, p, s;
long c;
unsigned short(q)(short d) { return d + b; }
int r(int *f) {
  if ((f[0] & 8) == 0)
    return 0;
  if ((f[0] & 12) == 0)
    return 1;
  if ((f[0] & 14) == 0)
    return 2;
  if (f[0] & 15)
    return 3;
  return 1;
}
int fn3(int h) {
  int i[] = {h};
  int j = r(i);
  return j;
}
void t() {
  int *u = &m;
  for (; s;)
    for (; p;)
      ;
  m = -3;
  for (; m <= -1; m = q(m)) {
    for (; fn3(*u + 8) + e + 9 + c < 15; ++c) {
 k++;
      n = 0;
      for (; e + n; ++n)
        o = 5 ^ *u;
 }
    if (n)
      l = a;
    for (; g; g = a)
      ;
 }
}
int main() {
  t();
  printf("%d\n", k);
}
%
% clang -O0 a.c && ./a.out
1
% clang -O3 a.c && ./a.out
0
%
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to