PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
Florian Weimer
fw@deneb.enyo.de
Fri Aug 5 20:55:00 GMT 2005
* Richard Kenner:
> No, the language (or, more precisely, GNAT) defines them as 0 and
> 2**size - 1. Otherwise the 'Valid attribute doesn't work. Necessary
> range checks will be optimized away, too.
>
> No, enumeration types are defined as having precisely the set of
> values specifically listed.
This is simply not true for Ada. Look at the definition of the 'Valid
attribute in the standard:
3. X'Valid
Yields True if and only if the object denoted by X is normal
and has a valid representation. The value of this attribute
is of the predefined type Boolean.
If your claim were true, 'Valid could never return False for
enumeration types.
More information about the Gcc
mailing list