http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50294

--- Comment #10 from rguenther at suse dot de <rguenther at suse dot de> 
2011-12-01 09:34:31 UTC ---
On Sat, 19 Nov 2011, ebotcazou at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50294
> 
> --- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-11-19 
> 21:35:48 UTC ---
> > Thus the question - what should stor-layout do with domain types
> > that wrap the wrong way around (i.e. are of wrong type because Ada
> > turns everything into sizetype instead of [s]sizetype dependent on
> > the Ada type "signedness")?
> 
> What do you mean by "Ada turns everything into sizetype" here?  AFAIK the Ada
> compiler behaves like the other compilers, i.e. domain types are built with
> 
> /* Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE.
>    MAXVAL should be the maximum value in the domain
>    (one less than the length of the array).
> 
>    The maximum value that MAXVAL can have is INT_MAX for a HOST_WIDE_INT.
>    We don't enforce this limit, that is up to caller (e.g. language front 
> end).
>    The limit exists because the result is a signed type and we don't handle
>    sizes that use more than one HOST_WIDE_INT.  */
> 
> tree
> build_index_type (tree maxval)
> {
>   return build_range_type (sizetype, size_zero_node, maxval);
> }
> 
> so are all subtypes of sizetype (gigi has create_index_type instead because it
> needs to have non-shared range types and lower bounds, but it's equivalent).

Sure, but only Ada allows user specified index types (AFAIK).  At least
for the C family domains are always unsigned and fit in sizetype.  The
middle-end / stor-layout code should get a "proper" domain type from the
frontends - either they canonicalize it to one that fits sizetype or
they provide a different typed domain (not sure which one is best,
but both are probably managable).

Richard.

Reply via email to