[PATCH] Fix packed enums in bitfields

Zack Weinberg zackw@Stanford.EDU
Fri Feb 2 10:00:00 GMT 2001


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


More information about the Gcc-patches mailing list