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

    <tr>
        <th>Summary</th>
        <td>
            [coroutines] miscompilation in clang 16 trunk vs clang 15
        </td>
    </tr>

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

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

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

<pre>
    I was experimenting with coroutines and symmetric transfer. 

https://compiler-explorer.com/z/457fqjbG8

I expected the coroutine to return 42 instead some random garbage.  Or at least 123 which is set when promise is created, it seems that optimiser is too eager. Other compilers (GCC and MSVC) are correcting expected value.

For some reason it optimises away ASM lines 17 & 18 which contains `return_value` function.

Commit of the clang 16 is `bf0bd85f9d823216501dcc09ae5461c2cf633ccf`

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxVUktvpDAM_jVwsToi4TkHDt2pWvVQ9VBprysTDKQNyWwSOtv99WuYzk4rAcGO4-8Rd67_aB_hhAHoz5G8nslGbUc46TiBct4tHFIAtD2Ej3mm6LWC6NGGgfwOkuwuyW7P3ynGY0jy20Te86PcfNSG_A03Ns5zMWc4_5ffoqyH36_dQ_P1-ONGQUXqIU50BYfowFNcvIVCgrYhEjIZNxMwjd7NMKLvcKQdwLMHjGAIQwQhczhNWk2gAwSKHJCFo3ezDrTmlCdktEQeQEeuoDkwMp93x6jXIr9WReeAuDuLfWZeHi7CAiSyeTgcNm-eXn4eErkH9BtzzzpWG_8rekez0O6r3HvnP0UwW2dXChdctvuEH3D78gRmc1_UjFWBaD4FKWcjshOQVNnZml8bAIcwLJaxnf0GdnDzvAIMZ2sNMjdRrfL4SDdkXd-Uw75vZC5FVWaiVyrbI5VFJZRUQ5XnSg1ceu6WUiuqal82RZWLtG_zfp_vMY06GmqT8sd1bpLyDljR2TJcafEFXvGjX-wbvIdLpkwXb9rvczTyJC7d5_AY835ZbvgmX9lcDnUIC2PJ-3IvpUintqg7xGagaujFQHVXFn2DKs_qvCo6NajUYEcmrFwTKS2dYGvB_0w41a3MuI-QtRR5Jppd3-SYNbWSklvURZ4UGc2ozW7lsXN-TH27UeqWMfCm0SGG6yaGoEdLmzVrf1zi5Hw7odXqDXsX0w293dj_A9C7KpE">