This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Handling non-constant bounds in extract_range_from_cond


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]