<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108698>108698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
wrong code at -O{2,3} on x86_64-linux-gnu
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zhendongsu
</td>
</tr>
</table>
<pre>
It appears to be a recent regression as it doesn't reproduce with 18.1.0 and earlier.
Compiler Explorer: https://godbolt.org/z/EGasYh8x1
```
[691] % clangtk -v
clang version 20.0.0git (https://github.com/llvm/llvm-project.git 223e2efa5e886502a9467b7ef700ebce9b7886e8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
[692] %
[692] % clangtk -O1 small.c; ./a.out
[693] %
[693] % clangtk -O2 small.c
[694] % ./a.out
Aborted
[695] %
[695] % cat small.c
char a[8];
int b = 1, c;
int main() {
for (; c < 8; c++)
a[c] = !c >> b;
if (a[0] != 0)
__builtin_abort();
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TXjy8CCSH0fdIjtaLGnPbSXngKKHMtsaNIgqSTNry8oOU42DQoU2AKETc48vnlDDkciBD1Zoh6qHVSHjZjjyfn-9URWOTuFeTM69Vf_PaK4XEj4gNHhSCjQkyQb0dPkKQTtLIqAOqJyFCzwJrku3qlZEj7reELWZizLUViFJLzR5DOE_AD53fq7d-eLNuTx_uVinCcPxR2eYrwEKO6AD8CHyanRmZg5PwEf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