http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39290
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-29
09:31:53 UTC ---
(In reply to comment #6)
> external ff, cc
> call q(ff)
>
> I absolutely *never* use implicit declarations, therefore I'm not sure: Is an
> "external ff" declaration supposed to get implicitly typed as real in comment
> 4?
The program is *valid*; as "ff" is referenced as function, it has to be
implicitly typed, which is "real" according to the implicit typing rules.
I concur that the standard does not very explicitly state this. But the
question (and example of comment 4) exactly matches the interpretation request
F03/0071 (cf. comment 0). J3/WG5 answered it
http://www.j3-fortran.org/doc/standing/links/016.txt - to quote from the answer
to Q2:
"2. The main program program unit is conforming, although the program
would not be if the external procedure FF were not in fact a real
function. If the reference had been to QR instead of Q, it would
be clear that FF has to be a real function, from the point of view
of the main program scoping unit. At the call site, the reference
to Q is known to be a reference either to QR or QC (the interface
block for Q is not defective), both of which require a function
actual argument. FF is known to be either a subroutine or a
function, since it explicitly has the EXTERNAL attribute, and if
it is a function it is known by implicit typing rules to be real.
Because neither specific in the generic allows a subroutine as an
argument, FF must therefore be a function. Since FF is real, QR
is called. (The generic cannot have a specific that accepts a
subroutine as an argument, as that would violate the requirements
in 16.2.3.)"