smart compilers

oacb2 oacb2 at ut-ngp.UUCP
Fri Dec 21 08:06:41 AEST 1984


> FORTRAN is less susceptible to clashes with the optimizer due to the
> device-register sort of hassle but more susceptible to poor programming
> such as parameter/COMMON aliasing, misunderstanding of modifying
> initialized COMMON, etc.

However, the IBM H Level FORTRAN Programmer's Guide does warn that code such
as

	DO 100 I = 1 TO 10
	IF (Y .GT. 0) X(I) = SQRT(Y)
    100 CONTINUE

(with X appropriately declared as an array of course) can cause an error
because it tries to take the square root of a negative number.  The optimizer
compiles this as if it were

	TEMP = SQRT(Y)
	DO 100 I = 1 TO 10
	IF (Y .GT. 0) X(I) = TEMP
    100 CONTINUE
-- 

	Mike Rubenstein, OACB, UT Medical Branch, Galveston TX 77550



More information about the Comp.unix.wizards mailing list