This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 23046. Folding predicates involvingTYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
- From: Laurent GUERBY <laurent at guerby dot net>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: fw at deneb dot enyo dot de, gcc at gcc dot gnu dot org
- Date: Fri, 12 Aug 2005 19:48:48 +0200
- Subject: Re: PR 23046. Folding predicates involvingTYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC)
- References: <10508121553.AA14309@vlsi1.ultra.nyu.edu>
On Fri, 2005-08-12 at 11:53 -0400, Richard Kenner wrote:
> I'm not saying that things aren't broken, just being very careful in the
> definition of what a "valid" value in an object is. The point is that these
> values are not "valid" (which is why 'Valid returns FALSE) and that the
> compiler (specifically VRP) is *correct* in deducing that the values are
> in the valid range of the type *except* for 'Valid and range checks.
You meant "for 'Valid range checks" right? (no "and").
My understanding is that VRP (the compiler) is free to remove all other
language mandated range checks based on type min/max information but has
to keep the ones generated for 'Valid.
An implementation model could be for the front-end to generate for each
family of scalar type T a function Base_Type_Internal_Valid (X, Min,
Max : in Base_Type_Of_T) return Boolean, generate a call to it at all
'Valid uses and then tell the compiler to never do any inlining at all
on such generated function.
Since I think there are not that many scalar base types around, I guess
such functions could even be included in the Ada RTS and not generated
on the fly.
Of course performance wouldn't be as good as possible, but if
there's no other way...
Laurent