1 ! RUN: %python %S/test_modfile.py %s %flang_fc1
2 ! Intrinsics SELECTED_INT_KIND, SELECTED_REAL_KIND, PRECISION, RANGE,
6 ! INTEGER(KIND=1) handles P < 3
7 ! INTEGER(KIND=2) handles 3 <= P < 5
8 ! INTEGER(KIND=4) handles 5 <= P < 10
9 ! INTEGER(KIND=8) handles 10 <= P < 19
10 ! INTEGER(KIND=16) handles 19 <= P < 39
11 integer, parameter :: iranges(*) = &
12 [range(0_1), range(0_2), range(0_4), range(0_8), range(0_16)]
13 logical, parameter :: ircheck
= all([2, 4, 9, 18, 38] == iranges
)
14 integer, parameter :: intpvals(*) = [0, 2, 3, 4, 5, 9, 10, 18, 19, 38, 39]
15 integer, parameter :: intpkinds(*) = &
16 [(selected_int_kind(intpvals(j
)),j
=1,size(intpvals
))]
17 logical, parameter :: ipcheck
= &
18 all([1, 1, 2, 2, 4, 4, 8, 8, 16, 16, -1] == intpkinds
)
20 ! REAL(KIND=2) handles P < 4 (if available)
21 ! REAL(KIND=3) handles P < 3 (if available)
22 ! REAL(KIND=4) handles 4 <= P < 7
23 ! REAL(KIND=8) handles 7 <= P < 16
24 ! REAL(KIND=16) handles 19 <= P < 34 (would be 32 with Power double/double)
25 integer, parameter :: realprecs(*) = &
26 [precision(0._2
), precision(0._3
), precision(0._4
), precision(0._8
), &
28 logical, parameter :: rpreccheck
= all([3, 2, 6, 15, 33] == realprecs
)
29 integer, parameter :: realpvals(*) = [0, 3, 4, 6, 7, 15, 19, 33, 34]
30 integer, parameter :: realpkinds(*) = &
31 [(selected_real_kind(realpvals(j
),0),j
=1,size(realpvals
))]
32 logical, parameter :: realpcheck
= &
33 all([2, 2, 4, 4, 8, 8, 16, 16, -1] == realpkinds
)
34 ! REAL(KIND=2) handles R < 5 (if available)
35 ! REAL(KIND=3) handles 5 <= R < 38 (if available, same range as KIND=4)
36 ! REAL(KIND=4) handles 5 <= R < 38 (if no KIND=3)
37 ! REAL(KIND=8) handles 38 <= R < 308
38 ! REAL(KIND=16) handles 308 <= R < 4932 (except Power double/double)
39 integer, parameter :: realranges(*) = &
40 [range(0._2
), range(0._3
), range(0._4
), range(0._8
), range(0._16
)]
41 logical, parameter :: rrangecheck
= &
42 all([4, 37, 37, 307, 4931] == realranges
)
43 integer, parameter :: realrvals(*) = &
44 [0, 4, 5, 37, 38, 307, 4932]
45 integer, parameter :: realrkinds(*) = &
46 [(selected_real_kind(0,realrvals(j
)),j
=1,size(realrvals
))]
47 logical, parameter :: realrcheck
= &
48 all([2, 2, 3, 3, 8, 8, -2] == realrkinds
)
49 logical, parameter :: radixcheck
= &
50 all([radix(0._2
), radix(0._3
), radix(0._4
), radix(0._8
), &
52 integer, parameter :: intdigits(*) = &
53 [digits(0_1), digits(0_2), digits(0_4), digits(0_8), digits(0_16)]
54 logical, parameter :: intdigitscheck
= &
55 all([7, 15, 31, 63, 127] == intdigits
)
56 integer, parameter :: realdigits(*) = &
57 [digits(0._2
), digits(0._3
), digits(0._4
), digits(0._8
), digits(0._16
)]
58 logical, parameter :: realdigitscheck
= &
59 all([11, 8, 24, 53, 113] == realdigits
)
63 !integer(4),parameter::iranges(1_8:*)=[INTEGER(4)::2_4,4_4,9_4,18_4,38_4]
65 !logical(4),parameter::ircheck=.true._4
67 !integer(4),parameter::intpvals(1_8:*)=[INTEGER(4)::0_4,2_4,3_4,4_4,5_4,9_4,10_4,18_4,19_4,38_4,39_4]
68 !integer(4),parameter::intpkinds(1_8:*)=[INTEGER(4)::1_4,1_4,2_4,2_4,4_4,4_4,8_4,8_4,16_4,16_4,-1_4]
69 !intrinsic::selected_int_kind
71 !logical(4),parameter::ipcheck=.true._4
72 !integer(4),parameter::realprecs(1_8:*)=[INTEGER(4)::3_4,2_4,6_4,15_4,33_4]
74 !logical(4),parameter::rpreccheck=.true._4
75 !integer(4),parameter::realpvals(1_8:*)=[INTEGER(4)::0_4,3_4,4_4,6_4,7_4,15_4,19_4,33_4,34_4]
76 !integer(4),parameter::realpkinds(1_8:*)=[INTEGER(4)::2_4,2_4,4_4,4_4,8_4,8_4,16_4,16_4,-1_4]
77 !intrinsic::selected_real_kind
78 !logical(4),parameter::realpcheck=.true._4
79 !integer(4),parameter::realranges(1_8:*)=[INTEGER(4)::4_4,37_4,37_4,307_4,4931_4]
80 !logical(4),parameter::rrangecheck=.true._4
81 !integer(4),parameter::realrvals(1_8:*)=[INTEGER(4)::0_4,4_4,5_4,37_4,38_4,307_4,4932_4]
82 !integer(4),parameter::realrkinds(1_8:*)=[INTEGER(4)::2_4,2_4,3_4,3_4,8_4,8_4,-2_4]
83 !logical(4),parameter::realrcheck=.true._4
84 !logical(4),parameter::radixcheck=.true._4
86 !integer(4),parameter::intdigits(1_8:*)=[INTEGER(4)::7_4,15_4,31_4,63_4,127_4]
88 !logical(4),parameter::intdigitscheck=.true._4
89 !integer(4),parameter::realdigits(1_8:*)=[INTEGER(4)::11_4,8_4,24_4,53_4,113_4]
90 !logical(4),parameter::realdigitscheck=.true._4