This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix packed enums in bitfields
- To: Jakub Jelinek <jakub at redhat dot com>
- Subject: Re: [PATCH] Fix packed enums in bitfields
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Fri, 2 Feb 2001 09:59:54 -0800
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- References: <20010202121434.H680@sunsite.ms.mff.cuni.cz>
On Fri, Feb 02, 2001 at 12:14:34PM +0100, Jakub Jelinek wrote:
> Hi!
>
> The following testcase prints warnings like:
> warning: width of `A' exceeds its type
> and does not give the expected 2 byte size of the whole thing as e.g. one
> driver in linux-2.4.0 expects (and gcc used to work that way e.g. in egcs
> 1.1.2 or 2.95.x).
> The change which broke this is Zack's 2000-01-05 change to
> finish_enum which now may leave TYPE_PRECISION of packed enums and
> also not packed enums requiring bigger type than int not
> corresponding to any type (e.g. in this case TYPE_PRECISION of the A
> and B enums is 2). What was the reason for this change? Making sure
> TYPE_PRECISION of such enums is TYPE_PRECISION of some type_for_size
> type fixes this (see below).
That was a long time ago. I believe I was just trying to silence
spurious warnings in the case where we have a positive enumeration
constant that fits perfectly well into a signed int, but we made the
whole enumeration unsigned.
Looking at the old change, I think I misunderstood the way
TYPE_PRECISION works.
Someone with more clue than me should review the patch.
zw