Richard Kenner wrote:
    Well, the point is that Gigi uses the fields TYPE_MIN/MAX_VALUE in a
way which is (now) incorrect,
No, that usage is correct.  What's incorrect is the way that 'Valid and
range checks are being implemented and/or optimized.  Those should not be
using the bounds of the subtype.

they do not!!!!!
the use the bounds of the base type

the problem is that the 'Valid in Ada really has no
analog in C. Actually the Ada 95 RM had this wrong, and
did not create the special rule for 'Valid, but this
was obviously intended, so an AI was issued to correct
this. The AI ensures that the sequence

    X : t;
    ...
    if X'Valid ...

is correct and works as intended to test if the
uninitialized value in X is invalid.

The Ada front end works by doing an unchecked conversion
of X to t'Base, followed by a range check. The issue is
to stop range propagation through the unchecked conversion.

we certainly do NOT want to say that the bounds of t are the
same as the bounds of t'base, since then we lose the
valuable range optimizations in all other cases. Only 'Valid
is special!

P.S. i do think that for the enum type the argument should
be the unsigned "base type". I will fix this
but it won't help the more general case

Reply via email to