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

    <tr>
        <th>Summary</th>
        <td>
            False positive in MemorySanitizer
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          shao-hua-li
      </td>
    </tr>
</table>

<pre>
    For the following code, `clang -O1 -fsanitize=memory` reports a use-of-uninitialized memory, but there is no in fact. `clang -O0 -fsanitize=memory` emits nothing.

Compiler explorer: https://godbolt.org/z/qaTdEb1rb

```shell
% cat a.c
%
% clang -O0 -fsanitize=memory a.c && ./a.out
%
% clang -O1 -fsanitize=memory a.c && ./a.out
==398997==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55f596212423 in main /a.c:6:9
...
%
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U0-PnD4M_TTmYoGCA-xy4DC_nR9VD91KbaWeQzCQKpBpEvbfp69gpu1qtR0JAYr93rOfHRWCGRfmBsr_oDwmao2T802YlEunVaXWJJ3rn5vWeYwT4-CsdY9mGVG7noHuECqhrVpGTD_nmA5BLSaaFwZ5nHl2_hkqgZ5PzseACtfAqRvSdTFbmrLmhXu8JNIddmvcZDyjCbg4NAsOSsfstYr4lwrPJm6oOJllzEAcQRzO7zs3n4xlj_x0ss6zB3nAKcZTAHkAaoHa0fWdszFzfgRqX4Dan-pb_3-X--41E1Ti_ISJrb2cUYlaRVSZ_nPwKnKt7A2DQBVQhRlQqzK3xisk7zp8jUQeQR5lfVvXN-f_74cv9x_vP2wGfNrRXy90uyfvjSd9UHblMx8iIpAUKJ7KcijrinIqSG5zmpVZcFfXIA8VyEN9xmRZ9raj3yYmfSP7WtYq4SavbkVVC1mIZGryTg-KhKwHXee6KkQhB9EVJeeDVHrgxDQkSIpClLmgshBZN3DeazHI_kYWsiAoBM_K2Mzah3mbamJCWLmp8rqoEqs6tmFfeqKFH3EPAtF2B3yzYdJuHQMUwpoQw1-WaKLlplU2MJ5cMNE88Nb-GzOT1dvmzYaZOK1dpt0M1G58l0968u4H6wjU7lUEoHav8lcAAAD__9-IGMg">