>
> Some weeks ago, I had asked over in comp.lang.fortran whether the
> following module should be accepted by a standard conforming compiler.
> I got three helpful responses (thanks, Sergio, Richard and Steve)
> ranging from ``could be'' to ``should be'', but nothing conclusive.
>
> It appears that the standard does not specify unambigiously whether
>
> FOO_X = BAR (X, FOO)
>
> is a ``function reference'' to FOO or not.
>
>
> recursive function foo (x, channel) result (foo_x)
> real, intent(in) :: x
> integer, intent(in) :: channel
> real :: foo_x
> if (channel == 0) then
> foo_x = bar (x, foo)
> else
> foo_x = 1.0
> end if
> end function foo
Seems pretty clear to me. On page 176, lines 19-21, the standard says:
If RESULT is specified, the name of the result variable of the function
is result-name, its characteristics (12.2.2) are those of the function
result, and all occurrences of the function name in execution-part
statements in the scoping unit are recursive function references.
I ran your code successfully on the Nag, EPC, Fujitsu, and IBM compilers.
John Reid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|