<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124612>124612</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
C++20 coroutine with stateful allocator results in ASAN stack-use-after-scope starting with clang 19
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bartdesmet
</td>
</tr>
</table>
<pre>
When trying to upgrade to clang 19, we ran into an issue where an ASAN violation is reported in code using a stateful allocator on a promise type. I've tried to reduce the repro in https://godbolt.org/z/soPP6x9rx which shows 18 and 19 side-by-side. It looks like the `stack-use-after-scope` occurs during the construction of the coroutine frame.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsUs1u3CAQfhp8Ga0F7NrOHnxIUlnKpYrUQ88YxjYN67Fg2M326SvcVK2qnAYG8c18PyYlP6-IvWieRPOlMpkXiv1oIjtMF-RqJHfvvy-4Ase7X2dggrzN0TgsRxvMOoM6C_0MN4RoVvArE5SaUka4LRixXB-_PX6Fq6dg2FN5hYgbRUYHfgVLDiGnMsBAYsM45QAmBLKGKQKtYGCLdPEJge8b1vAidHdF4OjRlVUiumwReMGCHKnALsxbEsdHoQehh5ncSIFrirPQw0-hh0Svr-37Ob7DbfF2gbTQLYF6ALM6UGdI3uFhvB9KreGFIRC9JQj-7fcg0crExr4dcsKDmRjjIVnaULQSyNocE7gcd9kWBEtr4pjtLgBNH71Imf2KMEVzwbpy_dGdj2dTYa-644OUzalT1dKPZnKddWbSxmLTPMjJoZNyPE3TUbdjW_leS91IpTt1Vl2jamlHObaT6tCpVk9GnCRejA91CNdLEaHaLeqVPrVKV8GMGNKeBK13X4XWJRSxLx8OY56TOMngE6e_EOw5YP8s9JPQT1r-w-fmefnMyogpB07Fnj0TnwpYupGLcDvMn5hVOYb-P1M9L3msLV2EHspaH-WwRfqBloUedppJ6OGD6bXXvwIAAP__3WUB6g">