This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS


On Sat, May 02, 2015 at 09:08:21AM -0400, Trevor Saunders 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?

8-bit int isn't C compliant, generally, char has to be at least 8-bit,
short and int at least 16-bit, long at least 32-bit and long long at least
64-bit (this comes from the C requirements of minimum value for
U{CHAR,SHRT,INT,LONG,LLONG}_MAX).  sizeof (int) == 1 was for the case
where e.g. char would be 16-bit and int as well, or 32-bit char and
32-bit int, etc.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]