[PATCH] libstdc++: Fix required aligment computation for floating points [PR122267]
Tomasz Kaminski
tkaminsk@redhat.com
Tue Oct 14 09:43:14 GMT 2025
On Tue, Oct 14, 2025 at 11:25 AM Tomasz Kamiński <tkaminsk@redhat.com>
wrote:
> Before the r16-4349-g90dde804626f13 the required aligment of floating
> point,
> and pointer specialization used __alignof__(_Vt) as required_aligment, and
> mentioned commit changed them to alignof(_Vt). This values differs on i686
> for double, as alignof(double) is 4, and __alignof__(double) is 8.
>
> This patch restores the previous behavior.
>
> PR libstdc++/122267
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/atomic_base.h
> (__atomic_ref_base<const _Tp>::_S_required_aligment): Use
> __alignof__
> instead of alignof.
> ---
> Tested 29_atomics/atomic_ref/* both with -m32 and without.
> Testing all on x86_64-linux locally. OK for trunk when tests passes?
>
All test passed.
>
> libstdc++-v3/include/bits/atomic_base.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/bits/atomic_base.h
> b/libstdc++-v3/include/bits/atomic_base.h
> index 0f3f6b1925d..7e4ad2b1272 100644
> --- a/libstdc++-v3/include/bits/atomic_base.h
> +++ b/libstdc++-v3/include/bits/atomic_base.h
> @@ -1538,7 +1538,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> _S_required_aligment()
> {
> if constexpr (is_floating_point_v<_Vt> || is_pointer_v<_Vt>)
> - return alignof(_Vt);
> + return __alignof__(_Vt);
> else if constexpr ((sizeof(_Vt) & (sizeof(_Vt) - 1)) ||
> sizeof(_Vt) > 16)
> return alignof(_Vt);
> else
> --
> 2.51.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20251014/70aa5041/attachment.htm>
More information about the Libstdc++
mailing list