[net.lang.ada] Suppressed Exceptions

firth@SEI.CMU.EDU (08/20/86)

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