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

            Bug ID: 122410
           Summary: std::atomic and std::atomic_ref not correctly aligned
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

As noted in Bug 122267 we do not enforce correct alignment of atomics in some
cases.

Quoting from Bug 122267 comment 9:

There's a pre-existing bug (before r16-4349) for atomic_ref<double> and
atomic_ref<T*> on cris-elf and m69k-linux-gnu, because they have weaker
alignment for those types. We need to align those to sizeof(double) and
sizeof(T*) respectively. But that was already wrong in GCC 15 so I'll fix that
separately.

And Bug 122267 comment 11:

I believe the same bug is also present for atomic<double> (__atomic_float base
uses __alignof__(double) on double member) and atomic<T*> (no alignment is
placed on pointer member). But this seem like ABI break.

And Bug 122267 comment 12:

atomic<floating-point-type> is new in C++20 so we can break it for GCC 16.

atomic<T*> is more of a problem for targets where it's underaligned for atomic
ops.

Reply via email to