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

    <tr>
        <th>Summary</th>
        <td>
            [clang] wrong code at -O0
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bi6c
      </td>
    </tr>
</table>

<pre>
    ```c
#include<stdint.h>
#include<stdio.h>

static long __undefined;

static int8_t g_3[1] = {0x03L};
static int32_t g_5 = 0x4B283066L;

int main (int argc, char* argv[])
{
 int8_t * const l_2 = &g_3[0];
    g_5 |= (l_2 != &g_3[0]);
 printf("%d", g_5);
    return 0;
}
```
Hello, we are using clang to compile the above code in Ubuntu 22.04.3 LTS.
We found a case that there are discrepancies when compiling with llvmorg-14.0.6 at optimization levels -O0.
```
$ ../compiler-builds/llvmorg-14.0.6_build/bin/clang -fsanitize=undefined -fsanitize=address --rtlib=compiler-rt -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err
1260925031

$ ../compiler-builds/llvmorg-13.0.1_build/bin/clang -fsanitize=undefined -fsanitize=address --rtlib=compiler-rt -g -lgcc_s -I/home/csmith/include/csmith-2.3.0 -O0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err
1260925030
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVF2P6yYQ_TX4ZWSEB3_lwQ836xu10kp9aKs-Rhhjm4pABDi7vb--wk52725v1R9QKYr5OGfmzGFAhKBnq1RHqiOp-kyscXG-G3Qts8GNf3WkZvtPEtYT9oUg11aadVSEP4U4ahvpQvjXf9l1329u_yGKqCUYZ2c4n1c7qklbNRJ-_AFK29ieI8xnTqpjQaoeCO-BNEf2yvgzafo32juB48aoNih7LY_YclbXz58yaBvhIrQFgm0aCz9Lgk8gF-EJfknz224KwcOd2NwjPHQlnHQ2RDBn3KVhvYtlifjICAC7ouZpB7UbHot_UvDwzrp6beNEsCWIBKtx-zylSB9gAOBVXL0F9l5j098Hj_Pbpz8pY1wK8qJAeAVr0HYGaYSdITqQ7nLVRkFcFIjB3RRINyrQFn4fVhtXQKSspByef_uV7hH_UDC51Y4gQIqQqCImvt8TjDpIr67CSq0CvCzK3pOkvC86LmDM7eL8nBclZbQGEcFdo77obyJqZ8GomzIB8l8Y_WFFBEuglODprt3nw6rNGAiePkY-b-sET4O2Cb7VnE9BWB31N0V4_9aMH5fFOHoVAuS5j0YPhPdvqXyEfIbczFKeA-Q_Ezwt7qJS-HDRcSF4etyHx1KOlFOW6oGoQkyeUQm5A_Wq5PcNmgqL-qLcGqEIkEpMEEDCv6YBVd7vyAJrdsCK8eIz_7-M4ZTR4n9gDPvUOtnY8fHADyJTXdEgK3lZIWZLxxiTE2IzTGycmkGNE5ZN3dZtVfBKVjLTHTIsWcPagmFbIp2wLqeJNweh6qFtFCmZughtaDKZOj9nOoRVdYeWsSYzYlAmbK8t4uZ0utRVn_ku4fNhnQMpmdEhhvcIUUezPdE7o-rhxaf3c7ucIibPstWbbonxGgj_QvBE8DTruKwDle5yP_L7J79696eSMZ1BkpY6Yld36_DvAAAA__9mtcy8">