Is the included code standard conforming?
FX Coudert
fxcoudert@gmail.com
Fri Sep 29 21:53:00 GMT 2006
> Unless I am quite mistaken, it is essentially impossible for a
> compiler to generate correct code in this case, at least if the
> program and subroutines are compiled separately. The main program
> does not have an explicit interface for test_r and test_d, and so
> the compiler has no way of resolving the generic to a specific
> prior to passing it. However, when test_r and test_d are compiled,
> the compiler has no way of knowing whether or not the passed
> function needs to be resolved from a generic to a specific (nor,
> most likely, any mechanism for resolving it).
Well, there are a lot of a intrinsic functions for which one specific
name (usually for the default real kind) is identical to the generic
name. (And I should know, because I've just changed the whole list in
intrinsic.c to be correct wrt the Standard a few minutes ago ;-)
Examples include: abs, acos, aimag, aint, anint, asin, atan, atan2,
conjg, cos, cosh, dim, dprod, exp, index, len, mod, nint, sign, sin,
sinh, sqrt, tan, tanh. The fact that this list does not contain log
is a mistery to me (as are the reasons behind the complexity and
oddities in this whole list). Richard Maine would probably have some
interesting insight into this, if he reads this mail and has time to
answer.
So, I guess we could (as a compiler extension) decide that LOG is
also a specific name for LOG, with a default real as argument.
FX
More information about the Fortran
mailing list