sizetype, bitsizetype and DECL_FIELD_BITPOS

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Sat Dec 25 18:36:00 GMT 1999


I'm a bit confused about the new bitsizetype and TYPE_SIZE_UNIT.

As I understand it, the purpose of this new code is to allow types and
objects to be 2**32 *bytes* long instead of 2**32 *bits* long (on
32-bit machines) that we used to allow.

So sizetype always measures bytes and bitsizetype always measures bits.
We have a TYPE_SIZE_UNIT to represent the size of a type in bits and
that's of type sizetype.

On 32-bit machines, as I understand it, sizetype will be 32 bits and
bitsizetype will need 64 bit arithmetic.

But what about DECL_FIELD_BITPOS?  That's used all the time when a fiekld
of a struct has variable size.  It used to be 32-bit, but now it looks
like it involves 64-bit arithmetic.  Is that what was intended?

Also, there is a comment referencing DECL_SIZE_UNIT, but I see no such
macros.  Then there's the code in get_inner_reference: first of all,
is OFFSET of bitsizetype or sizetype?  I see places where it is
used in both contexts and, unless I'm missing something, we are missing
conversions.  Secondly, the array code talks about if the bitsize
computation overflow, but I see no overflow test.

We've always said that DECL_FIELD_BITPOS was either or constant or
a variable possibily plus a constnat, where the variable was known
to be a multiple of BITS_PER_UNIT.  But now do we have to say that
it's a PLUS_EXPR of a conversion plus a constant and then change
teh code using it appropriately? I certainly don't think we want to
force all such computations to 64 bits.

Am I missing something here or are those bugs?


More information about the Gcc mailing list