This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
INTEGER or REAL?
- From: Angelo Graziosi <angelo dot graziosi at alice dot it>
- To: Fortran <fortran at gcc dot gnu dot org>
- Date: Mon, 23 Aug 2010 01:00:28 +0200
- Subject: INTEGER or REAL?
Sorry, but I do not understand why gfortran does not compile this code:
$ cat dp_test.f90
program dp_test
implicit none
integer, parameter :: DP = selected_real_kind(12,60)
call foo(0_DP)
contains
subroutine foo(x)
real(DP), intent(in) :: x
print *, x
end subroutine foo
end program dp_test
$ gfortran dp_test.f90
dp_test.f90:4.11:
call foo(0_DP)
1
Error: Type mismatch in argument 'x' at (1); passed INTEGER(8) to REAL(8)
WHY is '0_DP' interpreted as an 'INTEGER(8)' and not as a REAL(DP)?
For example, I can omit the dot in '0D0', '1D0' etc. WHY can't I do the
same with '_DP' ('0_DP', '1_DP' etc.)?
Sorry, I am just curious...
Ciao,
Angelo.