[J3] function references and optimization
Robert Corbett
rpcorbett at att.net
Tue Oct 9 15:44:53 EDT 2018
Van's latest e-mail led me to think
of a possible problem. Suppose
a program contains the statement
function
f(x) = y
and the assignment statement
x = y - f(1.0)
Does the mathematical equivalence
rule allow the expression to be
replaced with 0.0? What if f is an
internal procedure that returns the
value of y?
Oracle Fortran probably does the
first optimization at high
optimization levels. Statement
function references are inlined,
so the optimization phase would
see the expression as y - y.
Oracle Fortran probably does
not do the optimization if f is an
internal procedure. The
optimization could matter if the
value of y is infinite.
Robert Corbett
More information about the J3
mailing list