public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102024] [12 Regression] zero width bitfields and ABIs
Date: Tue, 24 Aug 2021 14:13:40 +0000	[thread overview]
Message-ID: <bug-102024-4-sBU6twJdOG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102024-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Michael Matz <matz at gcc dot gnu.org> ---
The only thing the x86-64 psABI says about this case is "'Unnamed bit-fields'
types do not affect the alignment of a structure or union." .

(zero-width bit-fields are _always_ unnamed)

But the x86-64 psABI was written with the assumption in mind that zero-width
bitfields influence the alignment of the following field (i.e. that they break
the current bit bucket for two neighboring bitfield members).  I.e. exactly
what GCCs
stor-layout.c code always did for these when not in microsoft compat mode.

In the example in question this align-next-bitfield item doesn't come into
play.  But it does show that zero-width bitfields were designed and allowed as
extension for a purpose.  So it makes sense for instance on platforms that have
a concept of homogenous aggregates that zero-width bit-fields disable those,
without otherwise changing memory layout.

So, I think, not removing those members from the FE makes sense, they contain
crucial information.  Unfortunately that means that they need to be dealt with
in code dealing with layout (correct) or argument/return-value passing
(seemingly
fishy right now for some platforms?).

Also, all else being equal I think the C language defines the de-facto psABI,
so any difference between C and C++ should be resolved towards C.

  parent reply	other threads:[~2021-08-24 14:13 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 14:36 [Bug target/102024] New: " jakub at gcc dot gnu.org
2021-08-23 14:38 ` [Bug target/102024] [12 Regression] " jakub at gcc dot gnu.org
2021-08-23 14:40 ` jakub at gcc dot gnu.org
2021-08-23 15:20 ` jakub at gcc dot gnu.org
2021-08-23 15:37 ` jakub at gcc dot gnu.org
2021-08-23 16:17 ` rsandifo at gcc dot gnu.org
2021-08-23 20:42 ` segher at gcc dot gnu.org
2021-08-23 20:49 ` segher at gcc dot gnu.org
2021-08-24  7:06 ` rguenth at gcc dot gnu.org
2021-08-24 14:13 ` matz at gcc dot gnu.org [this message]
2021-08-24 21:36 ` segher at gcc dot gnu.org
2021-08-25 19:23 ` wschmidt at gcc dot gnu.org
2021-08-25 19:33 ` wschmidt at gcc dot gnu.org
2021-08-25 20:08 ` wschmidt at gcc dot gnu.org
2021-09-03  7:53 ` cvs-commit at gcc dot gnu.org
2021-09-03  8:12 ` jakub at gcc dot gnu.org
2021-09-21 16:16 ` wschmidt at gcc dot gnu.org
2021-09-23 12:40 ` cvs-commit at gcc dot gnu.org
2022-01-10 16:47 ` cvs-commit at gcc dot gnu.org
2022-03-24  9:39 ` ebotcazou at gcc dot gnu.org
2022-03-24 11:25 ` cvs-commit at gcc dot gnu.org
2022-03-29 16:44 ` cvs-commit at gcc dot gnu.org
2022-03-29 16:45 ` cvs-commit at gcc dot gnu.org
2022-03-30 10:27 ` jakub at gcc dot gnu.org
2022-03-30 10:39 ` jakub at gcc dot gnu.org
2022-03-30 12:40 ` hp at gcc dot gnu.org
2022-03-30 12:43 ` jakub at gcc dot gnu.org
2022-03-30 13:05 ` jakub at gcc dot gnu.org
2022-03-30 13:42 ` xry111 at mengyan1223 dot wang
2022-03-30 13:53 ` jakub at gcc dot gnu.org
2022-03-30 14:34 ` xry111 at mengyan1223 dot wang
2022-03-30 19:02 ` xry111 at mengyan1223 dot wang
2022-03-31 12:36 ` segher at gcc dot gnu.org
2022-03-31 12:50 ` jakub at gcc dot gnu.org
2022-03-31 15:08 ` xry111 at mengyan1223 dot wang
2022-03-31 15:14 ` xry111 at mengyan1223 dot wang
2022-04-01  9:50 ` cvs-commit at gcc dot gnu.org
2022-04-01 14:39 ` cvs-commit at gcc dot gnu.org
2022-04-01 14:39 ` cvs-commit at gcc dot gnu.org
2022-04-02  0:47 ` segher at gcc dot gnu.org
2022-04-27  7:23 ` cvs-commit at gcc dot gnu.org

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=bug-102024-4-sBU6twJdOG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).