smart compilers
boyle at ANL-MCS.ARPA
boyle at ANL-MCS.ARPA
Fri Dec 21 00:26:42 AEST 1984
The view "If optimizing breaks programs which conform to the language
definition, the optimizer is broken" is not universally held. For
example, on the IBM Fortran H compiler (and probably also on
H-extended), if you wrote a loop with an if test to protect against
division by zero, and if the expression controlled by the if (the
expression with the divide) were constant with respect to the loop, it
would be moved out of the loop, *but the test would not*. Hence the
optimized program would divide by zero where the unoptimized one would
not. The Fortran Programmer's Guide even contained the statement that
"the program may not behave the same after optimization as before".
I never understood why they didn't optimize all programs to a return
instruction, so at least they would have been fast!
Jim Boyle
Math. and Comp. Sci. Div.
Argonne Nat'l Lab.
More information about the Comp.unix.wizards
mailing list