Handling non-constant bounds in extract_range_from_cond

Laurent GUERBY laurent@guerby.net
Mon Nov 29 23:31:00 GMT 2004


On Mon, 2004-11-29 at 23:52, Richard Kenner wrote:
> Those tests are "if Element.Port_Number not in Port_Number_Type" and
> 	 
>       if    Element.Port_Number < Port_Number_Type'First
>          or Element.Port_Number > Port_Number_Type'Last

May be it's from Ada 83 code, it's exactly to safely (in the
presence of more aggressive optimizers) replace this
kind of code that 'Valid was added to Ada 95.

The Ada 95 Rationale has a very clear chapter on
this language feature:

http://www.adaic.org/standards/95rat/RAThtml/rat95-p3-h.html#1-1

Nothing will replace programmer training :).

I don't mind the compiler being friendler for "X in Foo"
(but then I assume some users may complain about performance
so you'll have to add a switch to restore the more formal standard
behaviour) but for 'Valid use, I really hope that no optimization will
be done by GCC (and without reading the standard
you're unlikely to find out about 'Valid which is
not that current in programming languages...).

Laurent



More information about the Gcc-patches mailing list