madhur13490 wrote:
> Uh, are we sure that what Clang is doing here is actually correct?
>
> At least the ABI used by Clang is not the same as the one used by GCC:
> https://gcc.godbolt.org/z/Kec3Eqcz6 GCC seems to treat the struct of
> `_Atomic(float)` the same as the struct of `float`.
>
> The x86-64 SysV ABI specification unfortunately has no hits for `_Atomic`.
>
> cc @efriedma-quic
You're right to question it — this isn't psABI-mandated. The x86-64 psABI
doesn't mention _Atomic at all; it classifies aggregates purely by size and
field classes. Clang classifies struct { _Atomic(float) a, b; } as MEMORY only
because its classifier doesn't look through the AtomicType wrapper (the field
falls through to the default MEMORY), and the power-of-2 size inflation for
over-aligned atomics is the long-standing GCC incompatibility tracked in
llvm#26836. A plain reading (and GCC, which treats _Atomic as a transparent
qualifier) would classify it SSE, same as struct { float a, b; }.
I think if we are mirroring current Clang, then this should be fine?
https://github.com/llvm/llvm-project/pull/221367
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits