From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!nike!ucbcad!ucbvax!SEI.CMU.EDU!firth From: firth@SEI.CMU.EDU Newsgroups: net.lang.ada Subject: Suppressed Exceptions Message-ID: <8608201339.AA18971@bd.sei.cmu.edu> Date: Wed, 20-Aug-86 09:39:40 EDT Article-I.D.: bd.8608201339.AA18971 Posted: Wed Aug 20 09:39:40 1986 Date-Received: Thu, 21-Aug-86 01:36:36 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: In the example I : INTEGER := INTEGER'LAST+1 ... -- no use of I the relevant section of the LRM seems to be A predefined operation need not be invoked at all, if its only possible effect is to propagate a predefined exception [RM 11.6(7)] This appears to cover the case of the above code. As a more general point, the RM's philosophy on this issue is, broadly, "The purpose of computation is to yield results, not to propagate exceptions" and hence, a transformation that REMOVES an exception, but makes no other change in the effect of the program, is legitimate. This seems to be a hard point to get across. An exception is not part of the "normal" execution semantics of the code; it represents an error, failure, or boundary condition of some kind. If the compiler can transform the code so as to map a larger part of the input domain onto the "normal" output domain, and a smaller part onto the error condition, then that is a valid (and indeed good) transformation. As another case, consider if X < 1e100 where 1e100 is much bigger than FLOAT'LARGE. A compiler is free to replace the comparison with the value TRUE; it is not required to crash the program. Not only is this good behaviour, it is essential: the above fragment could occur, for instance, in the body of the SIN function ("is range reduction possible without total loss of significance?"), and we surely don't want that code to crash. Robert Firth