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: Problem with Selected_Real_Kind


RadSurfer wrote:
1 program test
2   implicit none
3
4   integer x
5   logical, dimension(3) :: a
6   real, parameter :: DP=selected_real_kind(9,99)
7   real (kind(dp)) :: u,v,w;
8
9   u = 2 * 3.1415_DP
10
11   write(*,*) 3.1415_(kind(dp))
12   write(*,*) 3.1415_DP
13
14 end program test

line 7 seems to differ from syntax most books suggest,
also
why is line 9 rejected?  I have tried DOZENS of different possibilities
and it appears gfortran does not permit what most fortran books and
online references say should work!  What gives here?

RadSurfer@yahoo.com

//Rich//


Chances are your compiler considers dp and DP to be the same.
Line 6 doesn't make much sense, as KIND values are integer, and setting DP as a default real surely conflicts with your lines 9 and 12 and should cause the compiler to find errors there.
Line 7, if it works, declares default real kind (the same kind you set for DP).
line 11, of course, shows a context where the KIND intrinsic should not be accepted.



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