Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gfortran.fortran-torture / execute / intrinsic_sr_kind.f90
blobc34a6ca5568d462303bfe9d24addafde27c174fe
1 ! Program to test SELECTED_REAL_KIND intrinsic function.
2 Program test_sr_kind
3 integer res, i4, i8, t
4 real*4 r4
5 real*8 r8
7 i4 = int (log10 (huge (r4)))
8 t = - int (log10 (tiny (r4)))
9 if (i4 .gt. t) i4 = t
11 i8 = int (log10 (huge (r8)))
12 t = - int (log10 (tiny (r8)))
13 if (i8 .gt. t) i8 = t
15 res = selected_real_kind (r = i4)
16 if (res .ne. 4) call abort
18 res = selected_real_kind (r = i8)
19 if (res .ne. 8) call abort
21 ! We can in fact have kinds wider than r8. How do we want to check?
22 ! res = selected_real_kind (r = (i8 + 1))
23 ! if (res .ne. -2) call abort
25 res = selected_real_kind (p = precision (r4))
26 if (res .ne. 4) call abort
28 res = selected_real_kind (p = precision (r4), r = i4)
29 if (res .ne. 4) call abort
31 res = selected_real_kind (p = precision (r4), r = i8)
32 if (res .ne. 8) call abort
34 ! res = selected_real_kind (p = precision (r4), r = i8 + 1)
35 ! if (res .ne. -2) call abort
37 res = selected_real_kind (p = precision (r8))
38 if (res .ne. 8) call abort
40 res = selected_real_kind (p = precision (r8), r = i4)
41 if (res .ne. 8) call abort
43 res = selected_real_kind (p = precision (r8), r = i8)
44 if (res .ne. 8) call abort
46 ! res = selected_real_kind (p = precision (r8), r = i8 + 1)
47 ! if (res .ne. -2) call abort
49 ! res = selected_real_kind (p = (precision (r8) + 1))
50 ! if (res .ne. -1) call abort
52 ! res = selected_real_kind (p = (precision (r8) + 1), r = i4)
53 ! if (res .ne. -1) call abort
55 ! res = selected_real_kind (p = (precision (r8) + 1), r = i8)
56 ! if (res .ne. -1) call abort
58 ! res = selected_real_kind (p = (precision (r8) + 1), r = i8 + 1)
59 ! if (res .ne. -3) call abort
61 end