This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Is the included code standard conforming?
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Brooks Moses <bmoses at stanford dot edu>
- Cc: gfortran List <fortran at gcc dot gnu dot org>, Richard E Maine <Richard dot Maine at nasa dot gov>
- Date: Fri, 29 Sep 2006 23:53:37 +0200
- Subject: Re: Is the included code standard conforming?
- References: <20060929205320.BC5A85BB8F@mailhost.lps.ens.fr> <451D9335.2080201@stanford.edu>
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