<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70507>70507</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Wrong code at -O2 on x86_64-linux_gnu since 4def99e
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
shao-hua-li
</td>
</tr>
</table>
<pre>
clang at -O2 miscompiled the following code.
Bisected to 4def99e642806f3f8e94cb2aa9356d63cd233dd0, which was committed by @LebedevRI
```console
% cat a.c
int printf(const char *, ...);
short a;
char b;
long c, d, e;
long *f;
static long **g = &f;
int h, i, j;
short(k)(short l, int m) { return m >= 2 || l > l << m; }
static long *n() {
int o[3][36];
h = 0;
for (; h < 3; h++) {
i = 0;
for (; i < 4; i++) {
j = 0;
for (; j < 9; j++)
o[h][i * j] = 55;
}
}
b = 0;
for (; b <= 2; b++) {
c = 0;
for (; c <= 2; c++)
k(a++, o[2][6]) && (f = &e);
}
return &d;
}
int main() {
n();
**g = 0;
printf("%d\n", 1);
}
%
% clang -O0 a.c && ./a.out
1
% clang -O2 a.c && ./a.out
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VMuuozgQ_ZpiUwoyZcxjwSKPiTTSSC3NZpYtY5zgtMFXYPp2__3IJskl6tstIb_q-FSdolxyns111LoBcQBxSuTiezc1cy_drl_kzpqkdd3PRlk5XlF63H0hHMys3PBmrO7Q9xovzlr3bsYrKtfpFNgJ2H4dD2bWygecw7zTl7rWRU4VKy78Uuk6Vy1JWXNRdAVXHXHedQzoiO-9UT2-yxmVGwbjA0X7EyFn_-hWd_r7v3_j1g8UbP2UG2dn9f2UBCrpUaZqPTCjx7fJjP4CVAWoR9XLCYH2wWuapkA18MOKnns3eZTPfYS2z611QXG414VBvxqA9pcPJi-9UfgwAO2vCPyEQMUHKATXByYThttrGEDVtxAbVWtUNgJHjwNQjVAecNJ-mUYcEPhfgZsQyiOUR7ThJI5H4EccgB8QytOnkY1A1Z1wtWN04kAcOIhTmIow86e5j0LY5uTiQkKr4CYYj8jjEugQvxdyRPPL_RcGExnyuPwNA-LtE44XlltkqePyybLFYpTYrxJNyATeQJwirxAvxM_UbVbY_ikL7Zr6E1Lc_UaG-nMi1AuJ-lTFN6BKPizHKIlWSfGnBY9UABWB8_IoQL0t-a28R0UBFd0T8DTH2pPmk4K5H205NyW_Ffh8ikAEJDoQxzEuj5htGZ5OgcTmZceetPvCwvt-KEuBzjJ1i19x2a9w-gP8g__RT5Ku4V3Na5noJivqKud1zfOkb-qsyolnkteivpRCt1VVZazNclaWkpVFYhpixDNGJTFBWZ7WHfE2a8ucC0VZ3UHO9CCNTa39PqRuuiZmnhfdlEywMrGy1XaOfZlo1O8YjSE74pRMTbiza5frDDmzZvbzB4s33urmv8ndG_KjbbsRf1TF1yLfWTMuP75exwVnMyr96MzJMtmm9_5tBr4HOgOdr8b3S5sqNwCdg4f7tHub3E0rD3SOcc1A5xj3_wEAAP__CUGeEg">