This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch - gcc-4.0 not c99 conforming when assigning scalar values to boolean bitfields
- From: Geoffrey Keating <geoffk at geoffk dot org>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Fariborz Jahanian <fjahanian at apple dot com>, gcc-patches at gcc dot gnu dot org
- Date: 31 Mar 2005 16:08:59 -0800
- Subject: Re: patch - gcc-4.0 not c99 conforming when assigning scalar values to boolean bitfields
- References: <26E1AC94-A231-11D9-B8B3-000393B9ED88@apple.com> <m2vf77h1u4.fsf@greed.local> <Pine.LNX.4.61.0503312301370.3529@digraph.polyomino.org.uk>
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Thu, 31 Mar 2005, Geoffrey Keating wrote:
>
> > I don't think this change is completely right. What happens if 'f2'
> > has size 200? I think your change would see that 32 < 200 and will
> > have no effect.
>
> A _Bool bit-field wider than the number of bits in a _Bool is a constraint
> violation. (It would appear to be a GCC bug that CHAR_TYPE_SIZE rather
> than BOOL_TYPE_SIZE is used in the test for this constraint for _Bool. It
> would appear to be a bug in C99 TC2 that by changing this constraint to
> refer to the width of the type, bit-fields of _Bool can no longer have
> width greater than 1 at all.)
Huh! Yes, it does say that. That would certainly solve this problem.
Do we want to simply do what TC2 says? It's not like oversized _Bool
bitfields are very useful, and it'll save a DR...