<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94897>94897</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 as it doesn't reproduce with 18.1.0 and earlier.
Compiler Explorer: https://godbolt.org/z/T9b4a7z3v
```
[576] % clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 338cbfef03e0ab58d7b52f3301928c58b194a1b4)
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
[577] %
[577] % clangtk -O0 small.c; ./a.out
[578] % clangtk -O1 small.c
[579] % ./a.out
Aborted
[580] % cat small.c
int a;
char b(char c, char d) { return c - d; }
int main() {
int e;
for (a = -10; a > -11; a--)
e = b(a, -1);
if (e > -2)
__builtin_abort();
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TX0ZSCBpCRLOugQx6uipx6694AfY5kNTRoklaT59QUlR86mRYECW8CwSc6bN2_omaGI0UwOcSDNgTTHnZjT2Yfh_YxOezfFeSe9_nP4fjYRxPWKIkRIHiSCgIAKXYKAU8AYjXcgIpgE2mN0hLfZdA1ezwrh1aQzsK5kJQXhNKAI1mAoCT0S-rB-P_rL1VgM8O3tan3AQKoHOKd0jaR6IHwkfJy8lt6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