This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: More on type sizes
- To: per at bothner dot com
- Subject: Re: More on type sizes
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Mon, 3 Jan 00 07:25:23 EST
- Cc: gcc at gcc dot gnu dot org
> We had to go through various contortions dealing with (say) a
> TYPE_MAX_VALUE of -1.
>
> I don't see why.
For example if the index type is defined as a sub-type of an
unsigned integer type. In that case, -1 one is not in the
index type, and in fact TYPE_MAX_VALUE is undefined.
It's interesting that Chill allows that. In Ada (and I though Chill
and Ada had some common heritage), the bounds of *any* array, whether
empty or not, much be values in the index type.
In Ada, if I have
type Index is 20 .. 30;
type Arr is array (Index range <>) of Character;
I can have members of type Arr that have bounds 30..29, 20..10, or 10..5
(all of which are empty), but *not* 31..30, since 31 is not a member of its
index type.
Can you say more about the typing rules of Chill in this area?
But my feeling is that if indeed a bound of Chill array can be outside the
bounds of its index type, then the index type actually in the tree needs to
be a different type, one that can contain all the values that are permitted
to be in the type. That seems, to me, the cleanest approach, by far.