C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] Atomics papers

From: Richard Smith <richardsmith_at_[hidden]>
Date: Wed, 10 Feb 2021 10:32:03 -0800
On Wed, Feb 10, 2021 at 12:29 AM Uecker, Martin via Liaison <
liaison_at_[hidden]> wrote:

> Am Mittwoch, den 10.02.2021, 07:43 +0100 schrieb Martin Uecker:
> > Am Dienstag, den 09.02.2021, 15:36 -0800 schrieb Hans Boehm via Liaison:
> > > On Tue, Feb 9, 2021 at 2:57 PM Joseph Myers via Liaison <
> > > liaison_at_[hidden]> wrote:
> > > A further complication (or simplification, depending on how you look
> at it)
> > > is that the ABI story here is currently badly broken for everything but
> > > simple types with size == alignment. The upside is that we can probably
> > > change more than one might expect, so long as we leave the simple (and
> by
> > > far most common) case alone. Everything else is largely broken and
> > > hopefully unused anyway.
> > >
> > > All of which is an argument to properly discuss this at a meeting ...
>
> https://godbolt.org/z/5jo3aY
>
>
> Here is a godbolt link for a test program. I tested only x86 on
> gcc/clang/icc
> and ABI is already broken. For basic types it works. For complex
> float/double
> alignment changes. Atomic struct types are not supported in ICC at all
> and ABI is inconsistent between GCC C / GCC C++ / clang C++ on the one
> side and clang C on the other (so also between clang C and C++!).
>

I've not run through all the cases but I don't think that's accurate.
Rather, I think we have:

GCC C _Atomic and libstdc++ std::atomic behave the same
Clang C _Atomic, C++ _Atomic, and libc++ std::atomic behave the same

(Note that the Clang on godbolt uses libstdc++ by default.)

So yes, a complete desaster.
>

Agreed. The psABI documents still haven't been updated to properly address
atomic size and alignment, years later. :-(


> Best,
> Martin
>
>
> _______________________________________________
> Liaison mailing list
> Liaison_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/liaison
> Link to this post: http://lists.isocpp.org/liaison/2021/02/0311.php
>

Received on 2021-02-10 12:32:16