[Bug libstdc++/114865] [13/14/15 Regression] std::atomic<X>::compare_exchange_strong seems to hang under GCC 13 for C++11

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 2 11:47:14 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114865

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #15)
> --- a/libstdc++-v3/include/std/atomic
> +++ b/libstdc++-v3/include/std/atomic
> @@ -238,8 +238,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  
>        constexpr atomic(_Tp __i) noexcept : _M_i(__i)
>        {
> -#if __cplusplus >= 201402L && __has_builtin(__builtin_clear_padding)
> +#if __has_builtin(__builtin_clear_padding)
> +#if __cplusplus >= 201402L
>         if _GLIBCXX17_CONSTEXPR (__atomic_impl::__maybe_has_padding<_Tp>())
> +#endif
>           __builtin_clear_padding(std::__addressof(_M_i));
>  #endif
>        }

Oh right, that still doesn't work in C++11:

/home/jwakely/gcc/15/include/c++/15.0.0/atomic: In constructor
'std::atomic<_Tp>::atomic(_Tp)':
/home/jwakely/gcc/15/include/c++/15.0.0/atomic:247:7: error: 'constexpr'
constructor does not have empty body

I remember hitting this when I implemented the padding stuff.


More information about the Gcc-bugs mailing list