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.
NB: BAR is _not_ recursive and adding the RECURSIVE keyword does not
help with the compilers that reject the module.
Can anybody shed more light on this?
Thanks,
-Thorsten Ohl
module bug
public :: foo
private :: bar
contains
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
function bar (x, f) result (f_x)
real, intent(in) :: x
interface
recursive function f (x, channel) result (fx)
real, intent(in) :: x
integer, intent(in) :: channel
real :: fx
end function f
end interface
real :: f_x
f_x = f (x, 1)
end function bar
end module bug
--
Thorsten Ohl, Physics Department, TU Darmstadt -- [log in to unmask]
http://crunch.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|