From: Jakub Jelinek <jakub@redhat.com>
To: tbsaunde+gcc@tbsaunde.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS
Date: Sat, 02 May 2015 08:03:00 -0000 [thread overview]
Message-ID: <20150502080313.GV1751@tucnak.redhat.com> (raw)
In-Reply-To: <1430537453-25556-1-git-send-email-tbsaunde+gcc@tbsaunde.org>
On Fri, May 01, 2015 at 11:30:53PM -0400, tbsaunde+gcc@tbsaunde.org wrote:
> + AC_TRY_COMPILE(
> + [struct foo1 { char x; char :0; char y; };
> +struct foo2 { char x; int :0; char y; };
> +int foo1test[ sizeof (struct foo1) == 2 ? 1 : -1 ];
> +int foo2test[ sizeof (struct foo2) == 5 ? 1 : -1]; ],
Shouldn't the 5 be sizeof (int) + 1? I mean, we have targets with 16-bit
ints. I hope no target sizeof (int) == 1, that would break this test too
(perhaps you could use long long :0; instead?).
Also, the anon bitfield changes alignment only on a subset of targets:
targetm.align_anon_bitfield ()
says if it makes a difference.
So, wouldn't it be better to test instead if
struct C { char a; char b : 1; char c; };
struct D { char a; long long b : 1; char c; };
int footest[sizeof (struct C) < sizeof (struct D)] ? 1 : -1];
? Tested that it works with powerpc compiler with -mbit-align vs.
-mno-bit-align.
Jakub
next prev parent reply other threads:[~2015-05-02 8:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-02 3:31 tbsaunde+gcc
2015-05-02 3:36 ` pinskia
2015-05-02 8:03 ` Jakub Jelinek [this message]
2015-05-02 13:08 ` Trevor Saunders
2015-05-02 13:26 ` Jakub Jelinek
2015-05-03 9:00 ` Andreas Schwab
2015-05-04 7:38 ` Trevor Saunders
2015-05-04 17:46 ` Jeff Law
2015-05-05 3:39 ` [PATCH] Improve the test in bitfields.m4 tbsaunde+gcc
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=20150502080313.GV1751@tucnak.redhat.com \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tbsaunde+gcc@tbsaunde.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).