[Bug libstdc++/71660] [6/7/8 regression] alignment of std::atomic<8 byte primitive type> (long long, double) is wrong on x86

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 12 18:24:00 GMT 2018


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

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Thiago Macieira from comment #14)
> It was trying to guard against exactly what you said above: that the
> alignment of a QAtomicInteger<T> was exactly the same as the alignment of a
> plain T inside a struct, so one could replace a previous plain member with
> an atomic and keep binary compatibility. 

That is not expected to work.

> But it's clear now that atomic types may need extra alignment than the plain
> types. In hindsight, the check is unnecessary and should be removed; people
> should not expect to replace T with std::atomic<T> or QAtomicInteger<T> and
> keep ABI.

Agreed.

But what we do care about is comment 2, i.e. _Atomic(T) and std::atomic<T>
should have the same alignment (both in an out of structs). Maybe that needs
the C front-end to change how _Atomic works, or maybe it needs the C++ library
to change how std::atomic works, but I want to keep this bug open while comment
2 gives different answers for C and C++.


More information about the Gcc-bugs mailing list