[cfe-dev] [PATCH] libc++: help diagnosing the following std::atomic compile error
David Chisnall
David.Chisnall at cl.cam.ac.uk
Tue May 21 06:11:16 PDT 2013
On 21 May 2013, at 01:55, Howard Hinnant <hhinnant at apple.com> wrote:
> I've enclosed a proposed patch for fixing <atomic>. This patch changes us from using _Atomic(T) for the stored type, to just T, but aligned to _Atomic(T).
This may still end up with the std::atomic<> types lacking padding in structures that makes it possible to act on them correctly. For example, what do you get when you do:
struct {
std::atomic<char> x;
char y;
};
y should be sufficiently after x that they can be operated on independently (at least from an ISA perspective - if they're in the same cache line then most RISCy CPUs will do a bit of redundant work anyway). Even though the alignment of y is 1, we (typically) should be adding 3 bytes of padding after x.
David
More information about the cfe-dev
mailing list