smart compilers
Mark Brader
msb at lsuc.UUCP
Wed Dec 26 17:51:12 AEST 1984
Ho hum, all of you are wrong. The CORRECT optimization for:
DO 100 I = 1 TO 10
IF (Y .GT. 0) X(I) = SQRT(Y)
100 CONTINUE
Is, in Ratfor syntax:
IF (Y > 0) {
TEMP = SQRT(Y)
DO I = 1,10
X(I) = TEMP
}
ELSE
I = 11
(In some implementations the number 11 will be something else, most
likely 10, but leaving I unchanged is clearly wrong!)
Moral: This is not only trickier than it looks, it's trickier than that!
Mark Brader
More information about the Comp.unix.wizards
mailing list