This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 05 Aug 2005 22:55:30 +0200
- Subject: Re: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
- References: <10508052051.AA11169@vlsi1.ultra.nyu.edu>
* 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.