double precision function two()
two = 2.0d0
end function two
program xx
print*,two(),kind(two())
end program xx
mingw g95 Jan 23 2007 says
In file bug_print.f90:1
double precision function two()
1
In file bug_print.f90:6
print*,two(),kind(two())
2
Error: FUNCTION 'two' is of type REAL(8) at (1) and type REAL(4) at
(2)
but gfortran and Intel Fortran accept it and give output
2.000000 4
, and I think they are correct. If one replaces "double precision"
with "real" the code works.
My gfortran and ifort (linux) give the following ouput:
0.0000000E+00 4
You can compile it with -r8 option to make it work with g95.
f95 mytest.f90
Error: mytest.f90: Wrong data type for reference to function TWO from
XX
Cheers,
Joost
-warn:all
option is used.