host association question

Dominique Dhumieres dominiq@lps.ens.fr
Sun Nov 19 22:16:00 GMT 2006


> If you add () to the above, then gfortran gives
> 
> laptop:kargl[208] gfc -o z m.f90
>  In file m.f90:9
> 
>  real :: internal_f(n)
> 		   1
> Error: Variable 'n' cannot appear in the expression at (1)

Since I am not sure that the code is valid if n is not defined,
I tried

program test_internal
implicit none

integer :: n
n=5
print *, size(internal_f())

contains

function internal_f()
 real :: internal_f(n)

internal_f = 2

end function internal_f

end program test_internal

which prints 5 with xlf and g95 but gives the same error
with gfortran. So it looks like a bug in gfortran, though
I let more competent people decide about it!-)

Dominique



More information about the Fortran mailing list