<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70470>70470</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
wrong code at -O1 and above 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>
This appears to be a recent regression.
Compiler Explorer: https://godbolt.org/z/5GY9nahrd
```
[562] % clangtk -v
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 8ff14223536d6645d7c92b4488e3eb676e548cb1)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/opfuzz/bin
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
[563] %
[563] % clangtk -O0 small.c; ./a.out
[564] %
[564] % clangtk -O1 small.c
[565] % ./a.out
Floating point exception
[566] %
[566] % cat small.c
int a, b, e, g;
short c, d, f, h = ~1;
int main() {
for (a = -30; a != -2; a += 7) {
f = a;
e = (unsigned)f > -1U >> 16 ? f : 0;
c = 1;
b = e;
for (; g < 4; g++) {
int i = -c, j = i / ~(d ^ 1);
if (b)
d = (1 - i) ^ 1;
c = h;
b = j;
}
}
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU2P5CYQ_TX0pdSWjfHXwYeZ7vUqpxyyOeQUYSjbzNLQAjwzmcP-9gj6Y6Y7o0iRNpaFoareq0cJF9x7NRvEnlSPpNpv-BoW6_q3BY20ZvbrZrTyr_7bojzw4xG58xAsjAgcHAo0ARzODr1X1mQk35P84TTu7OGoNDr48nrU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