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

    <tr>
        <th>Summary</th>
        <td>
            C++20 coroutine miscompiled if it contains a dispatch table + computed goto
        </td>
    </tr>

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

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

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

<pre>
    Repro: https://godbolt.org/z/j3o96sYd1
clang trunk accepts the program, but miscompiles it.
gcc trunk compiles the program correctly.

The program implements a simple interpreter using the a dispatch table as described, e.g., in https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables.

The problem only occurs when combining coroutines with a dispatch table and a computed goto. A switch-based interpreter works as expected.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU81y2yAQfhrpwkiDUGzHBx2cZPoAnV565GeFSBBoWIjrPn1XSty4aWYQ7P9--4FUNJfhOywpVv2JTTkvSEIlvtGy0ajocxuTJe03fc99PO7xp-kq_lTxk_YyWJZTCS9Mag1LRpYnYFTNJjlX4pGpktnsUMd5cR6Qudy-5Vqt3zP_-m5SyZgS6Owv7-Fv-4-bCDcvHmYI1FMy3DTmQoa0JKCdFXQrOMqQzDhcZNYTy1JRmERmAHVyCswKElrbrqcLnxgA71qqYBNAWLzU0AbIZBe8E3TwA22btM5QMpjGxhybMaYGxtFpR_Caa_Nma45fDUT2mcXgLyxqXRKy8wRhJUa5sE5BbMSSXSCSzi5PX0wUDBmvKNiKomUnhhRNjZVEMt6Sc47pBVce4NdCNINpazP05tgfZZ1d9jA8VuKBluAfzW8ukqqNdJfkC1m6gP8jotx_8dQl-eHTA6NZimopjBTvX69HQ5Q8EyxSHWIBJGG3v-v39TR0WvXA1b7Xx30nj73RIA6dGEV_3wmux9pLBR6HakfwRYAz20qQXO2eajcILgQ_8IPou4PoWnq2kgMXaqe1GHf31R2HWTrfrjjWl1-nYYOkikVyeocZP5wS0dkAsLWj-rLkKabhNVrCYAHp_6i3_sOG_w-H6ijT">