This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/17211] [sparc/i386]: Bitfields should be *unsigned* by default.
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2004 17:03:09 -0000
- Subject: [Bug target/17211] [sparc/i386]: Bitfields should be *unsigned* by default.
- References: <20040827145141.17211.terra@gnome.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-08-27 17:03 -------
Subject: Re: [sparc/i386]: Bitfields should be *unsigned*
by default.
On Fri, 27 Aug 2004, terra at gnome dot org wrote:
> C99 only requires bitfields of base types _Bool, enums, int, signed int, and
> unsigned int. No char, no short, and no long long -- they are left to the
> implementation.
C99 says "or some other implementation-defined type".
At present we support no such types; see implement-c.texi. Attempts to
use such types get pedwarns with -pedantic.
Suppose we were to support short as such a type. 6.7.2#5 says that short,
signed short, short int and signed short int all designate the same type.
It has an exception for int as a bit-field type, but none for short.
Thus if an implementation supports short bit-fields as an
implementation-defined bit-field type, they must be the same as signed
short bit-fields. This may be a defect, but it is the clear meaning of
the standard is it is at present.
I don't think we should change to supporting such types as
implementation-defined bit-field types without a DR on this, and another
DR on the meaning of sizeof applied to an expression derived by arithmetic
on bit-field types wider than int.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17211