]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix required alignment computation for floating points [PR122267]
authorTomasz Kamiński <tkaminsk@redhat.com>
Tue, 14 Oct 2025 09:06:35 +0000 (11:06 +0200)
committerTomasz Kamiński <tkaminsk@redhat.com>
Tue, 14 Oct 2025 11:10:23 +0000 (13:10 +0200)
Before the r16-4349-g90dde804626f13 the required alignment of floating point,
and pointer specialization used __alignof__(_Vt) as required_alignment, 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_alignment):
Use __alignof__ instead of alignof.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/include/bits/atomic_base.h

index 0f3f6b1925d3f72c656ae4fce416d5bc2aa5ad97..7e4ad2b12723c2aafd3a2521086fc841e24ef156 100644 (file)
@@ -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