<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/98838>98838</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            wrong code at -O3 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/fzsqjEPWW

```
[562] % clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 52139d8f9a4e3f595ca552393d62ba06b0bc082c)
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
[563] % 
[563] % clangtk -O2 -w small.c
[564] % ./a.out
0
[565] % clangtk -O3 -w small.c
[566] % ./a.out
[567] % 
[567] % cat small.c
int printf(const char *, ...);
int a, b, e, g;
volatile int c;
static int d[1] = {1}, f;
int h() {
  for (b = 0; b < 4; b++) {
    for (e = 0; e < 4; e++)
      while (b) {
 if (c > 0 && d[1])
          break;
        return f;
      }
 }
  return 0;
}
void i() {
  int *j[1];
  j[g] = &d[0];
}
int main() {
  h();
  printf("%d\n", a);
  return 0;
}
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VcuO6zYM_RplQ8SQ6UfshRd5jIu7aoEWuMtClhRHM4qUSnIyna8vZCdO5nELFLgNDEUmDw8Padlk3qveSNmQ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