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

    <tr>
        <th>Summary</th>
        <td>
            Miscompile with [[clang::musttail]]
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          gerben-stavenga
      </td>
    </tr>
</table>

<pre>
    When adding [[clang::musttail]] to a tail function call the program crashes. Inspection of the output asm clearly shows the stack return address is written over by a skewed memcpy. Without [[clang::musttail] the function runs correctly and -fsanitize=undefined,asan does not indicate any problems

https://godbolt.org/z/Y7fq1xK54

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEkkGPmzwQhn-NuYwSGROS5cBh94uQPlU9r3oc7AHcNTb1DJtmf30FqVqph_Ziy_KjmWdGLzL7MRK1qn5R9bXAVaaU25FyT_HAgu8URyz65O7t60QR0DkfR9jxFxswjqp6VtXzvLII-qDqq6qvIAkQtjcMa7TiUwSLIYBMBEtOY8YZbEaeiI_wf-SFHlAadiStsqwCyDPYQJjDHXhKN94_WdC-QSZZ8-6TiRk8wy17EYqQ3ilDfwcEfqMbOZhptsv9CK9eprTKX-X3Dr-c8xoZbMqZrIQ7YHRwGBijF_9Bqrqu0dHgIzll_kPGCC4RQ0wCPjpvUQgw3reJ-0AzK31V-vlxTiILb-1Np0w3JtenIMeUR2W6D2W6L5fhW_n9U3164IVrK9dUDRbUlhetdX0-l0_F1DbDxfWXxp7OpE_lMJSkTdn0zZmIXF3pwrdGm6osy7qs6nP9dNRVZSo9oO2bp2a4GHXSNKMPxxDe582g8MwrtRdTNboI2FPgPR_GPHZmzBaV3G78oV9HVicdPAv_riBeArWfPds0Lz4Q3LxM_0pNsebQ_rEXL9PaH22alem26j-vw5LTV7KiTLfLsjLd7vsjAAD__z4a7kA">