This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: host association question


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]