<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/74739>74739</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Wrong code at -O1 and above on x86_64-linux_gnu (recent regression)
</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 -O1 and above produces the wrong code.
Bisected to e4710872e98a931c6d5e89bc965b778746ead2c0, which was committed by @nikic
Compiler explorer: https://godbolt.org/z/n4Kj5WPKe
```console
% cat a.c
int printf(const char *, ...);
int a;
short b, c = 1;
short *e = &b;
char f;
int main() {
int g = c, h = -1, i = -1, d = 8;
g |= 0 || i;
if (d)
a = 2;
*e = f ^ a + h + i + g + h;
printf("%d\n", b);
}
%
% clang -O0 a.c && ./a.out
0
% clang -O1 a.c && ./a.out
1
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U02PpDgM_TXmYoGC-QgcONTHcpnD7G2Oo5CkILNUUkrCdM_--lXonqrabmkkBMbv-dmxYxGCma3WAzRHaM6Z2OLi_BAW4fJlE_lqssmpX8NpFXZGETH_WqKwCsXkfmq8eac2qQPGReOLd3ZG6ZQugJ2BHd7eRxO0jFphdKhrXrKOk-470VelbFWju36SfdtMnHe8brVQJBnQCV8WIxd8EQGlu15NTBLTL4SaWfOPkfic4-SuN7Nqj_r1tjqvPVQHXGK8BagOQCPQODs1uTUWzs9A479Ao62__Gi-_f1FPytBy94e6Wxw62-MGpQioijkm8PYiDdvbLwAdYkaUS7CI9Ah1V4UBVAP1fHBFve_sDgfcUo8iVCdsfwAAR30DgC10x3b9S__07wKY4E6oB6Bv_sREzLv8TLlWHYzL5Ntnmy1291dEFMQPyUn2w1-QvOEmgsCdSqd692DKHYNemLda78gNH8lAh1TCXRMyemYkiTPI-TeRiACahQ0J7ubp9SjRxOBn-_DeJrKfjHzryzNJjUMqMUCaBSF2-Ibj32ml3-glx_T_L4SmRoq1Ve9yPRQclb2bd_1bbYMfVcLJqTkjaqqRjI5dayt2YVLWQrN28wMxKgqifGSU920hZRiUqq8SKEFF7KEmumrMGuxrj-v6Y5mJoRND7zmVZ-tYtJr2HeUyOoX3MHUpOac-SHF5NM2B6jZakIMD5Vo4qqHb_fN_LzCzuJr135v63w1dnv9PtstzdlrqW1Er2evQzDOAvXZ5tfhw1aZuGxTId0VaExZ3z_5zbsfWkagca81AI37Wf4LAAD__0QlPAc">