<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69210>69210</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>
It seems to be a recent regression.
Compiler Explorer: https://godbolt.org/z/Ee8M1Ge3e
```
[535] % clangtk -v
clang version 18.0.0 (https://github.com/llvm/llvm-project.git f41ec27f7eba34548a280a4a4d7de2ef32837210)
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
[536] %
[536] % clangtk -O0 small.c; ./a.out
0
[537] % clangtk -O1 small.c; ./a.out
2
[538] % cat small.c
int printf(const char *, ...);
#pragma pack(1)
struct {
int : 1;
int b : 18;
int : 12;
int c : 8;
int : 23;
} d;
unsigned short a, e, f;
static long g = 1;
int h;
void l(long *i) {
char j = f;
h = ~(1 && g);
d.b = ~((h ^ e) | j);
}
int main() {
l(&g);
for (; a < 1; a++)
printf("%d\n", d.c);
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU2P4ygQ_TXkUoplg79y8CEf49EcVnvYva8wlB26CUSAu3v7sL99BUk76cxopJVmpcgxRb3H41EuuPdqMogdqXakOqz4HI7Wde9HNNKayc-rwcq_u28BPOLJQ7AwIHBwKNAEcDg59F5ZkwHJDyTfXp57ezorjQ6-vJ21degI28IxhLMnbEtoT2g_W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