Ada subtypes and base types

Robert Dewar dewar@adacore.com
Sun Feb 19 20:04:00 GMT 2006


Laurent GUERBY wrote:
> On Sun, 2006-02-19 at 14:23 -0500, Richard Kenner wrote:
>>     "Second, for a given integer type (such as
>>     natural___XDLU_0_2147483647), the type for the nodes in TYPE_MIN_VALUE
>>     and TYPE_MAX_VALUE really should be a natural___XDLU_0_2147483647.
>>     ie, the type of an integer constant should be the same as the type of
>>     its min/max values."
>>
>> No, the type of the bounds of a subtype should be the *base type*.  That's
>> how the tree has always looked, as far back as  I can remember.
> 
> This is because intermediate computations can produce results
> outside the subtype range but within the base type range (RM 3.5(6)),
> right?

No, it is because this is the way the language is defined, what
other type could the bounds of a subtype have? Clearly they are
not of the subtype itself (that would be a nonsense recursion).



More information about the Gcc mailing list