From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85819 invoked by alias); 2 May 2015 13:08:47 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 85810 invoked by uid 89); 2 May 2015 13:08:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 May 2015 13:08:45 +0000 Received: from tsaunders-iceball.corp.tor1.mozilla.com (unknown [23.233.68.71]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id AA693C07C; Sat, 2 May 2015 13:08:42 +0000 (UTC) Date: Sat, 02 May 2015 13:08:00 -0000 From: Trevor Saunders To: Jakub Jelinek Cc: tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS Message-ID: <20150502120846.GA32141@tsaunders-iceball.corp.tor1.mozilla.com> References: <1430537453-25556-1-git-send-email-tbsaunde+gcc@tbsaunde.org> <20150502080313.GV1751@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150502080313.GV1751@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-05/txt/msg00135.txt.bz2 On Sat, May 02, 2015 at 10:03:13AM +0200, Jakub Jelinek wrote: > 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?). yeah, I just mindlessly ported the test program in tm.texi. I'm dubious anyone tries to use objective C on machines with 16 bit int, and doing it on a machine with 8 bit int sounds insane, but who knows, and maybe something else will need this test some day? > Also, the anon bitfield changes alignment only on a subset of targets: > targetm.align_anon_bitfield () > says if it makes a difference. the use of anon bitfields with width 0 seemed dubious to me without knowing about this. > 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. seems reasonable to me. fwiw I committed the original patch last night since Andrew ok'd it, but obviously we can improve it. We should probably update the test in tm.texi at the same time, or I guess better yet just refer to the m4 test there. Trev > > Jakub