<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64830>64830</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Implement __builtin_clear_padding (used by libstdc++ for P0528R3/P1123R0)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
comex
</td>
</tr>
</table>
<pre>
This is basically identical to #46030 except for GCC instead of MSVC.
C++20 includes [P0528R3](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0528r3.html) and [P1123R0](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1123r0.html), which together require `std::atomic<T>::compare_exchange_strong` and `std::atomic_ref<T>::compare_exchange_strong` to ignore any padding bits that exist in `T`. libstdc++ implements this using a builtin added to GCC, `__builtin_clear_padding`. Clang should implement this so that the feature works correctly when using libstdc++ with Clang.
See also: #64829 for libc++ support.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0U8GOpDYQ_Rr3pTTIlIGGA4cZJr3KIVK0O8q1ZewCvDE2sU16-u8jd89kNIki5bIXsDH13qvnejJGMzuintVPrH4-yD0tPvTKr_R6GL2-9i-LiWAijDIaJa29gtHkUl5D8sBQVA0XHOhV0ZZg8gG-DAMYFxNJDX6CX779NhSMPzP-eH8ODJ8YPiEH45TdNUVg9dOvvMb2q2D1M8N2SWmLTDwyPDE8XS6Xwm_kHmLShQ8zw9P3pEqGp6gQ8w8z5p32KjI8bXKjkBfIyzbvM3IQxZJWy7AD6fSNsCxRfOU_gjAjB_5OyHCAy2LUAsnPlBYKEOiP3QQC1vCYdOYVjzL51Sgmhhcmfrp_Un7dZKAzvapFupnOMQXvZtbwexP_qj4Hmv4vQvJgZucDgXRX2KTWxs0wmhQhLTIBvZqYwLhM88IaXgBYM8ak1f3-wKybpZXcrcBE2GMGkDDuxibjQGpNOtN8GYbsAWv4-fx2eFaWZDi_sd7RByvdDHHxu9Uf4Hfs6O-i0kIwkUx7ILj48HsE5UMglewVLgu5NxGfhV5MWu7on-bwGxFIGz0Tj3mOm6rF7jbA1ozvpXHfNh9ScdC90J3o5IH6sumwOoqqag9L39SaV9NEWE8V8YnqFuvjWMqqUsdpEtPB9MhR8Lbsyk7w6lhUsmx0M3VHLSdO9cgqTqs0trD2zzVP28HEuFPfVK3gBytHsvGWT0RHF7gdMsQc19DnmodxnyOruDUxxQ-UZJKl_ue_ffwP74Fhu0fSMF7_YVu24j2VeHqPC3aHPdj-c2Bmk5Z9LJRfGZ6ygrfXwxb8d1KJ4emmO4fk1tdfAQAA__9XiGtX">