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

    <tr>
        <th>Summary</th>
        <td>
            Coroutine compilation on x86_64
        </td>
    </tr>

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

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

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

<pre>
    ae7bf2b80b9bc6ff1adca0beed03f545fd40a35b (which fixed a coroutine miscompilation, https://github.com/llvm/llvm-project/issues/51843)  causes a coroutine miscompilation for me. Unfortunately the reproducer is huge, I can try to reduce it if there's no other option.

clang 15 works; I bisected llvm-project to this commit.

In this code:

```c++
 template <typename T>
    void await_suspend(std::coroutine_handle<T> h) {
        when_ready = h;
        main_coroutine_task = &h.promise(); // for waiting_task()
        schedule(this);
 }
```

h.promise() returns garbage, after which the program crashes. It's compiled with asan/ubsan, but I have no indication that it's related so far.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVEGPqzgM_jXpxdoKEqBw4DDT2Uq9754rJzEkO5CgJLSv_34VmPdm3hz2sCgiAtufnc-fgzHa0RH1rH5l9dsB12R86PFu3-3dpudBev3skU5y4LItZCdVMwwlaoWFJNKFGOqqHnRVoKglMN4-jFUGBvuDNCAoH_yarCOYbVR-XuyEyXrH-BlMSktk4oXxC-OX0SazyqPyM-OXabr_3P5Ygv-HVGL8YmNcKTJ-qcu2Eox3AArXSPE_EsHgA8x0hL_d4ENaHSaanpAMQaAleL0qCmAjmHWkXNUVFDpI4QnJQ6BsB5vADjkmEOOnCM6Dz1_gl5zjyIo3VrzsbzWhG6Gs4eHDe2TiFa4gbSSVSMPXA2X8ZGwE5efZpt9Aru6nSVNm6IuJNcW-FOOveW1_IdG8TJgImDin50IOZ4K_mPjzww4Ad2814ANtusU1LuQ0421MOicQL78IvBl0eiImzjkcTOaZnV4_cfLzMORugVA_gYk3MEx8c5jRutsnZsL4vnky3pjjEvxsIzHeMt5linYJbL3K9Vk3bhEfDr8BR2VIr1MOzhTtAB8u7PT2jaSvzH3LC4HSGlyEEYPEvfk4JAqwSzhLZAl-DDiDChgNxSNc0yaAXWCk4WGTAYzoGL-sctvPINcEVzB4p6wU67RVuxaTwQR2hwiU26UhehgwfHT_oHuhO9Hhgfqyaauma9tOHExfnagaZCOlGAZdci7LoZSqqTquha5IH2zPCy6KmpdlV1e1OPKhaWrRNqeOZFVrZFVBM9rpmDV49GE8bOPUN7yt-GFCSVPcbgHOHT1gMzLO86UQ-k23ch0jq4rJxhQ_UZJNE_XnX-P3dfa8gx9tc2uqwxqm_v_P-1bjvwEAAP__6D95Xw">