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

    <tr>
        <th>Summary</th>
        <td>
            Aggressive optimization caused by a conditionally uninitialized (but at least unused) argument
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          gmc-devel
      </td>
    </tr>
</table>

<pre>
    The minimal sample on [https://godbolt.org/z/cTPTaWhx3](https://godbolt.org/z/cTPTaWhx3) shows an issue of kind of code elimination by the optimizer, if a call may use a (conditionally) uninitialized argument (pArg). The static analyzer (--analyze) will give further information about the cause:

`warning: 1st function call argument is an uninitialized value [core.CallAndMessage]
        return (*fp)(pArg);
 ^~~~~~~~~~~`

But I've not found any option (like/similar to -Wconditional-uninitialized ) to be informed about this kind of "surprising" side-effect (code elimination) at compile-time. FYI: this kind of optimization seems to be active on -O1 or higher and since LLVM/clang-version 14.

IMHO, I think there should be warnings-option to be informed about (not really dead) code elimination caused as a side-effect of another issue like an uninitialized variable or argument.

Best regards from Salzburg,
Markus
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2P4kYT_jXNpWRkN2DwwQeYedE70o42UkZZ5Vh2l-3OtLtRfzCBQ357VMaZhc0e4gMWclfV89WFIejeEtVicxCb5wWmODhf92ObKTqTWTROXeq3gWDUVo9oIOB4MgTOgtgchhhPQaz2Qh6FPPZONc7EpfO9kMerkMf27Zc3_Db8uRKbZyF3__24rCAM7iMAWtAhJALXwbu2it-tUwRk9KgtRu0sNBeIA4E7RT3qK3khn0B3gNCiMTDiBVIgQBBy1zqrNBehMRcek6y2Omo0-koK0PdpJBv56GnPwKolMP0QMeoW0KK5XMnz9yyb_3GbD20M9PpM0CUfB_Kgbef8eAOIjUtxwthiCsQS5M8i_-e3zD_QW217sdpDESJ0ybZT4UTgE5Se9HhEfEaTiL1onaflExqzt-qVQsCeWPVpAsyPp5i8ZfBC7ruTkNV3nmJ1mA-Lzf_--nxEmd9jPaQIL0JuzwTWRehcsgrQXibx3dTa6HcS8hj0qA16iA6yb3eyZ4_4WbzooKFZMDZhVkuHT8uFlCH5k9eBVZISglaUUddRG2-2PkaCu2KE1o0nbSiLeqQlHH9_YYEfGs-ZudkUiMYwo8E2spvOQva1AOdh0D3bilZB0LYl-PLlt1cOrUHbZ2fygVsU6-W9XC-v___KaXzhqfadI-CJo52M4imz7yGb5fupEkLuWGtPnFlQhIrp_esWTNFSgAHwQR7XAVp3y-R0ldignwXJa2z4avvPxD1wOVBgED16FaDzboRf0VybxOl5uh15Rf-ewkLVK1WtKlxQXZRVtV4VeS4XQ73FvMRNVeZqKyVV6zJvyq3c7Yq12hT5Bhe6lrlcFUW-y3dcs8S2y6mq2u12W5R5hWKd04jaLI05j7w5FhOleluUq3JhsCETpl0mpaWPG18hJa82X3NN1qQ-iHVudIjhe5eoo6F63_eeQph8v8_FrGxz4ZVyv0DgxyzvmhQ5eIYwREiW66YszoIukjf1D2tQxyE1y9aNQh4Z0PzKTt79QW0U8jjRCEIeJ5p_BwAA___SY-iB">