<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87534>87534</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
wrong code at -O1 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 regression from 14.0.0, and affects 15.* and later.
Compiler Explorer: https://godbolt.org/z/57cnEr81r
```
[546] % clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 07a566793b2f94d0de6b95b7e6d1146b0d7ffe49)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/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
[547] %
[547] % clangtk -O1 small.c
[548] % ./a.out
Aborted
[549] % cat small.c
struct a {
int b;
int c;
int d;
int e;
int f;
} g, h = {1,0,0,0,0}, *i;
void j(struct a k) {
struct a *l = &g;
if (k.b)
l = i = &k;
if (l != &k)
__builtin_abort();
}
int main() {
j(h);
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU1v4zYQ_TXjy8ACRVFfBx0ce1XsqYf2HlAiJXNNkwZJJWl-fUHJUbRuUaBAFvCHhvPmzRtqOOTeq9FI2UD-BPlpx6dwtq55P0sjrBn9tOus-Kv5HpDfbpI7j8FiJ5Gjk6OT3itrcHD2iilLSEKAHpEbgXwYZB88pnkC9DAvaR6kSxDICchh-T3a601p6fDb201bJx1kBzyHcPOQHYC2QNvRis7qkFg3Am3fgbZ52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