public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <idsandoe@googlemail.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	Jim Wilson <jimw@sifive.com>, GCC Development <gcc@gcc.gnu.org>
Subject: Re: gcc vs clang for non-power-2 atomic structures
Date: Fri, 23 Aug 2019 18:59:00 -0000	[thread overview]
Message-ID: <DEBD590E-3F3D-4D23-8509-765D46252384@googlemail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1908231558130.10989@digraph.polyomino.org.uk>

Hi Joseph,

> On 23 Aug 2019, at 17:14, Joseph Myers <joseph@codesourcery.com> wrote:
> 
> On Fri, 23 Aug 2019, Iain Sandoe wrote:
> 
>> absolutely, it’s the psABI that’s lacking here - the compilers (as commented
>> by Richard Smith in a referenced thread) should not be making ABI up…
> 
> With over 50 target architectures supported in GCC, most of which probably 
> don't have anyone maintaining a psABI for them, you don't get support for 
> new language features that require an ABI without making some reasonable 
> default choice that allows the features to work everywhere and then 
> letting architecture maintainers liaise with ABI maintainers in the case 
> where such exist.

yes. That’s perfectly reasonable
However, it’s more than a little disappointing that X86, for which I would hope
that the psABI _was_ considered supported, remains silent on the issue so long
after it arose (I guess the interested parties with $ need to sponsor some work
 to update it).

> (ABIs for atomics have the further tricky issue that there can be multiple 
> choices for how to map the memory model onto a given architecture; see 
> <https://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html>.  So it's not 
> just a matter of type sizes and alignment.)

Indeed, I have tangled a bit with that trying to adapt libatomic to be better
behaved on Darwin.

> but where psABIs 
> specify something we do of course need to follow it (and the choice may be 
> OS-specific, not just processor-specific, where the ABI is defined by the 
> default compiler for some OS).

agreed .. it seems highly likely for X86 as things stand - since there’s a
bunch of things already out there with different ABIs baked in.
> 
> Note: it's likely some front-end code, and stdatomic.h, might have to 
> change to handle the possibility of atomic types being larger than 
> non-atomic, as those end up using type-generic atomic load / store 
> built-in functions, and those certainly expect pointers to arguments of 
> the same size (when one argument is the atomic type and one non-atomic).

It seems to me that whatever might be chosen for the definitive psABI / platform
(i.e. arch + OS + version) going forward, we will need to support what has
been emitted in the past.

So a recommendation for suitable FE hooks  (and preferably a way to make
the C11 atomic match the std::atomic, even if this is “only” a QoI issue),
would be worth addressing.

thanks
Iain

> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com

      parent reply	other threads:[~2019-08-23 18:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22 23:56 Jim Wilson
2019-08-23  7:21 ` Iain Sandoe
2019-08-23  9:36   ` Jonathan Wakely
2019-08-23 10:13     ` Iain Sandoe
2019-08-23 11:17       ` Jonathan Wakely
2019-08-23 16:14       ` Joseph Myers
2019-08-23 18:49         ` Jim Wilson
2019-08-23 18:59         ` Iain Sandoe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DEBD590E-3F3D-4D23-8509-765D46252384@googlemail.com \
    --to=idsandoe@googlemail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jimw@sifive.com \
    --cc=joseph@codesourcery.com \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).