<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118248>118248</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Miscompilation 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>
When I compiled this code with -O2/3, its output is `0 0 0 0`. With -O0/1, its output is `0 0 1 0`.
```c
int printf(const char *, ...);
int a, b, c, d, i;
int e[4][4][1];
long f;
int **g;
int *h = &b;
char j = 176;
int k(int l) {
a += l;
return a;
}
int main() {
for (; f <= 6; f++) {
int ***m[2];
for (; k(65535 - 65473) + j < 2;)
m[c] = &g;
*h = 0 != m[0];
}
e[0][2][0] = b;
for (; i < 4; i++)
printf("%d\n", e[d][i][0]);
}
```
Compiler Explorer: https://godbolt.org/z/xscGf4rG7
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VM2yszYMfRqx0YSxZQxkwSI_5ZsuOl1-a2Mc8C2BDDa3t336ju3ckHamEw8y8tHRkSKjnLPDbEwD8gzymqnNj8vaaLX2dlAzZ6zOuqX_q_k5mhl_Rb3cH3YyPfrROtRLb_BP60c8_E5ArQC6oPUOl80_No_WIZSMYfxByXL8mcAMqOX_C-YJDOwUVsnS0sBOdvb4WO3sb0C1XmbnUY9qRaBTYMvzHOgI4vyEquDswkOHRx8z7scG5LkAed0NDyaeT8s84G3Hxgyn4V-OEUFcEajskjtK-YhOXpU79A-gOtgJ6IhQBTeiQqBzgE4JiLgav60zqvQO1fUZfld2Bqrfg29LqLkGccYbgrgEnjK-BdKwdizirh_odAd5pleZ4fiNLCgtpRQSD1jKohKRiM6xqgtSCKLjMw4xcGmQ1-8-DDvpqz0MgXjYBDB7S5wKxPgvsNR-SoZ9U3bf2DeJNiop4vZVbAC95gKIgGQP8jLH7SWm6BO33VO8RiUpeQ1amrtLmvQVf_l6TMtqVhAnHL1_OBAnoBaoHZa-WyafL-sA1P4N1H45_eNWrD-qrG9EfxRHlZmGV0JwLgtZZGNTyUoRl7ouhZKd7vuq04p3WnXm2CujMtsQo4ITI1bIShQ5cSHkjZSRXPS1KaFg5q7slE_T5z3kzqxzm2k4r6mos0l1ZnLxPhPpSc1DaIK8ZmsTAg7dNjgo2GSddzuFt36KH4EUIa_4m3XpsitvlxmVx3TFs22dmv_0wfpx63K93IHaQPk0h8e6fBjtgdoo0YVbn1R-NvRPAAAA__88NjDu">