------- Comment #2 from burnus at gcc dot gnu dot org  2009-10-06 14:57 -------
See also PR 41604.

I actually cannot find the spot in the standard which renders this example as
invalid. Reading the following excerpt, I have even the feeling that it is
valid:


"A char-length type parameter value of * has the following meaning: [...]

(4) If used to specify the character length parameter of a function result, any
scoping unit invoking the function shall declare the function name with a
character length parameter value other than * or access such a definition by
host or use association. When the function is invoked, the length of the result
variable in the function is assumed from the value of this type parameter."
(F2003, 4.4.4.1 Character type specifier)


As NAG f95 does not diagnose the problem in PR 41604 and ifort (-warn all)
talks about "interface" although there is no interface, the diagnostics might
be bogus.

 * * *

Richard Maine wrote in the thread at comp.lang.fortran:

"If a call was legal before, it is still legal with an explicit interface
(almost always*). [...]
The exceptions are arcane, mostly involving some obscure things that
are basically incompatible with having an explicit interface. The only
one I can think of at the moment is assumed-length character function
results"

The question is only whether an explicit interface is not allowed (as the
compiler error implies) or that the explicit interface may not use a "*"

 * * *

Maybe one could argue the following for disallowing the interfaces:

a) "12.2.2 Characteristics of function results": "If the length of a character
function result is assumed, this is a characteristic."

b) "An interface body specifies all of the characteristics of the explicit
specific interface or abstract interface."

c) "If an explicit specific interface is specified by an interface body or a
procedure declaration statement (12.3.2.3) for an external procedure, the
characteristics shall be consistent with those specified in the procedure
definition, except that the interface may specify a procedure that is not pure
if the procedure is defined to be pure."


If the latter is the correct reading then one needs to have an implicit
interface with a character length (which is not "*, cf. PR 41604), but using an
explicit interface is not allowed.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41603

Reply via email to