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

    <tr>
        <th>Summary</th>
        <td>
            Wrong codegen from TBAA under stores that change effective type?
        </td>
    </tr>

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

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

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

<pre>
    Copied from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107115 (link to godbolt changed to the one with Clang and MSVC):
> The attached test case is from user supercat on Stack Overflow (original source: https://stackoverflow.com/questions/42178179/will-casting-around-sockaddr-storage-and-sockaddr-in-break-strict-aliasing/42178347?noredirect=1#comment130510083_42178347, https://godbolt.org/z/zWK4TYsEs) and demonstrates what appears to be wrong TBAA optimization on an object with allocated storage whose effective type changes under stores.

Observation: on Clang the bug triggers at -O1, while on GCC the bug triggers at -O2.

@AaronBallman @EugeneZelenko Add tags: clang:codegen, miscompilation, TBAA.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx1U01v2zAM_TX2RbBhy3E-Dj6kabvDMPTQYsN2KWiJsbXIkifJCdpfP8pJti7AANuhJIp8fO-ltfKt2dlRoWR7ZwfWhzD6pNom_JGeToi8M1NuXUerdureldZAoe_t6ZXWuehUUj0qmVT3ZbEqy5olfK2VObBgWWdla3VgogfTUQfaCj0ya5CdVOjZTtM-AyPZl-evu4RvYuPiPim2SfXAXigVQgDRx6voqQ54ZMqfkU4eHfPTiE5AoJrsmVIP7OmIbq_tKeKwTnXKgGbeTk4gVb-Zz8cr9nIjF3agvV8TtVLWeIoXvFyty9WGwhNNnhGAoEyXgbOTkZm34gBSuswH66DDDD5uKpO1DuFAp06JkIFW4On2tW61WBF1xjqUyqEIkcKEV4RiQBPKqqjLolhXr3-S-e5WnjO_F3ne4_vt8-Llu38g8JuZWIkDjRIcEIHs1BNTMI4IzkcxWtLBWZLg5W67ZXYMalDvEIePfAJ9258E7CwWaG2JadLiMi2Vs6QH7veUo47IwtuIF609I36iPpSKPr-IOn-fWhLuOHeJglCjsw2iM8hRjMjqOiSAhDV7KuPUp17paBv2abf7Tx7_p0eyKLakkbkj0APNQeuHqUODP1CjOVi2lWQp6CKVTMT2FAgrkXJiw0F5kmFU-gyTdiJDeYpNuVzWZVWvllUqm0puqg2kQQWNzbeZyUuRs0VnWj8SQeDh-ne4IY6skE5ONzcKE_NTe3Gm1sfrTzY6G6WhpfKeHEtBvea8TvsGOV-vVkKUSyGXNSw5b8uS_AP7thaAy1RDi9o3SX2X1PepanjBOVltVWwWfFHlooZ6Xxa1rFDsN-s1kYcDKJ3HxtFrqWtmDKSCp0OtfPB_D8F71RnEa32YQm9dMw7WlVU6o21mqL8Bd2977A">