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

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
(In reply to Richard Smith from comment #2)
> I think that's only true for objects whose size corresponds to that of a
> fundamental type. Consider:
> 
> struct B { char c[3]; };
> 
> Here, an atomic object of type B (eg, _Atomic(B) or std::atomic<B>) would
> have size=4, align=4, and yet GCC treats B as having an alignment of 1 for
> the purpose of atomic accesses.

No, this does not appear to be true. With GCC size/align are 3/1 while with
Clang it's 4/4 as you said:

struct B { char c[3];};

_Atomic struct B b;

int a = _Alignof b;
int s = sizeof b;

s:
        .long   3
[...]
a:
        .long   1
        .comm   b,3,1

Reply via email to