<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/129181>129181</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Miscompile at -O2/3
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          cardigan1008
      </td>
    </tr>
</table>

<pre>
    This code prints random value at `-O2/3` and 92 at `-O0/1`:

```c
int printf(const char *, ...);
int b[0];
int c;
int d;
int e;
int f() {
  d = 7;
  for (; 4 + d; d--)
    e += 92 & 1 << d;
  return e;
}
int main() {
  int g = f();
  printf("%d\n", g);
  c = b[g];
  return 0;
}
```

Compiler Explorer: https://godbolt.org/z/1KdhfczMW

It starts from clang-13. 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcUk2rnTAQ_TXjZriSTNSrCxf3o0Ipj24KXUcTNUXNJYmP9v36Er0fjweBDIeZcw5nRnpvhkXrGvIz5NdErmG0ru6kU2aQC2esTFqr_tW_RuOxs0rjzZkleHRyUXbGdzmtGmVAKNjhJwE1AgqGclFY0RNnQA2HgoE4AdtewfbXATuZJeysPVDZ2cUH7EbpEOgEdME0TYEqEOd7awv5mUF-fSHdq1SvUr_KSAxUIRwjgqgQxBWPewNib6NYCeKMGQKdNxZUh0PUjQ2IOuJxqCIEKpAjiAuIy0MQ0emwuuWhCsfrXXuWZvkiH-Fhs3A39uB4pgBEQLmC_LJs5QWHT23dNhtzGJ45PA2wzwaeOe-xX-x8M5N2-O3vbbJOOxAnHEO4-bgZaoCawarWTiG1bgBqPuLifqix7z7efu8c3wP6IF3w2Ds7YzfJZThwkWKiaqEqUclE1_yYsSMvSfBkrKllsteqIpbJsih6IZXiLGOk84wxYompiVHOiEqW5UzwVHOpiq7npTy2LecMMqZnaaZ0mt7naC0x3q-65lTxkieTbPXktxsm2gzF0PJr4uo4cGjXwUPGJuODf1EEE6bt8PeJ_Ipvxnd7QvFy7-ecrG6qv2Rkwri2aWdnoCby3b_Dzdk_ugtAzebPx_R2i-81_Q8AAP___sTzsw">