This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC libatomic ABI specification draft
- From: Michael Matz <matz at suse dot de>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Torvald Riegel <triegel at redhat dot com>, Bin Fan <bin dot x dot fan at oracle dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Mon, 23 Jan 2017 15:00:08 +0100 (CET)
- Subject: Re: GCC libatomic ABI specification draft
- Authentication-results: sourceware.org; auth=none
- References: <cbd2c83a-b50b-b2ac-b62d-b2d26178c2b1@oracle.com> <db02a1bf-0eee-15a5-0e1f-f8124021e45d@redhat.com> <a73c2aa3-31d4-05a6-19e6-f9efa98fbfe3@redhat.com> <8764e547-1dd2-3ebd-2723-6568b4b54092@oracle.com> <ac2d60ed-a659-f018-1f11-63fa8f5847f5@oracle.com> <1470412312.14544.4.camel@localhost.localdomain> <4a182edd-41a8-4ad9-444a-bf0af567ae98@oracle.com> <8317ec9d-41ad-d806-9144-eac2984cdd38@oracle.com> <c2d90b1a-0b0e-0460-d28f-a02ad15f5ab3@oracle.com> <1484672405.5606.420.camel@redhat.com> <2cc60e20-8b70-1be3-e052-b3c0f5b0750c@redhat.com> <alpine.LSU.2.20.1701201436410.31530@wotan.suse.de> <280f53fc-31d1-d1d6-35f5-154672e5c463@redhat.com>
Hi,
On Fri, 20 Jan 2017, Richard Henderson wrote:
> > You can't have a 4-aligned type of size 3. Sizes must be multiples of
> > alignment (otherwise arrays don't work). The type of a 3-sized field
> > in a packed struct that syntactically might be a 4-aligned type (e.g.
> > by using attributes on char-array types) is actually a different type
> > having an alignment of 1. It's easier to simply regard all types
> > inside packed structs as 1-aligned (which is IMO what we try to do).
> >
> > That is, the byte after a 4-aligned "3-sized" type is always padding.
>
> [ I read Bin Fan's original email some months ago, but I don't have it handy
> now. Take faulty memory with a grain of salt. ]
>
> I thought this was about libatomic being presented with an unaligned 3-byte
> structure that happens to sit within an aligned 4-byte word, and choosing to
> atomically operate on the 4-byte word instead of taking a lock on the side.
Ah well, in that case I lost context as well ;)
Ciao,
Michael.