[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / modfile26.f90
blob77bef3104bd8989b9c9c30ccc3ecfcd9d8d39386
1 ! RUN: %python %S/test_modfile.py %s %flang_fc1
2 ! Intrinsics SELECTED_INT_KIND, SELECTED_REAL_KIND, PRECISION, RANGE,
3 ! RADIX, DIGITS
5 module m1
6 ! INTEGER(KIND=1) handles 0 <= 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 0 <= P < 4 (if available)
21 ! REAL(KIND=3) handles 0 <= P < 3 (if available)
22 ! REAL(KIND=4) handles 4 <= P < 7
23 ! REAL(KIND=8) handles 7 <= P < 16
24 ! REAL(KIND=10) handles 16 <= P < 19 (if available; ifort is KIND=16)
25 ! REAL(KIND=16) handles 19 <= P < 34 (would be 32 with Power double/double)
26 integer, parameter :: realprecs(*) = &
27 [precision(0._2), precision(0._3), precision(0._4), precision(0._8), &
28 precision(0._10), precision(0._16)]
29 logical, parameter :: rpreccheck = all([3, 2, 6, 15, 18, 33] == realprecs)
30 integer, parameter :: realpvals(*) = [0, 3, 4, 6, 7, 15, 16, 18, 19, 33, 34]
31 integer, parameter :: realpkinds(*) = &
32 [(selected_real_kind(realpvals(j),0),j=1,size(realpvals))]
33 logical, parameter :: realpcheck = &
34 all([2, 2, 4, 4, 8, 8, 10, 10, 16, 16, -1] == realpkinds)
35 ! REAL(KIND=2) handles 0 <= R < 5 (if available)
36 ! REAL(KIND=3) handles 5 <= R < 38 (if available, same range as KIND=4)
37 ! REAL(KIND=4) handles 5 <= R < 38 (if no KIND=3)
38 ! REAL(KIND=8) handles 38 <= R < 308
39 ! REAL(KIND=10) handles 308 <= R < 4932 (if available; ifort is KIND=16)
40 ! REAL(KIND=16) handles 308 <= R < 4932 (except Power double/double)
41 integer, parameter :: realranges(*) = &
42 [range(0._2), range(0._3), range(0._4), range(0._8), range(0._10), &
43 range(0._16)]
44 logical, parameter :: rrangecheck = &
45 all([4, 37, 37, 307, 4931, 4931] == realranges)
46 integer, parameter :: realrvals(*) = &
47 [0, 4, 5, 37, 38, 307, 308, 4931, 4932]
48 integer, parameter :: realrkinds(*) = &
49 [(selected_real_kind(0,realrvals(j)),j=1,size(realrvals))]
50 logical, parameter :: realrcheck = &
51 all([2, 2, 3, 3, 8, 8, 10, 10, -2] == realrkinds)
52 logical, parameter :: radixcheck = &
53 all([radix(0._2), radix(0._3), radix(0._4), radix(0._8), &
54 radix(0._10), radix(0._16)] == 2)
55 integer, parameter :: intdigits(*) = &
56 [digits(0_1), digits(0_2), digits(0_4), digits(0_8), digits(0_16)]
57 logical, parameter :: intdigitscheck = &
58 all([7, 15, 31, 63, 127] == intdigits)
59 integer, parameter :: realdigits(*) = &
60 [digits(0._2), digits(0._3), digits(0._4), digits(0._8), digits(0._10), &
61 digits(0._16)]
62 logical, parameter :: realdigitscheck = &
63 all([11, 8, 24, 53, 64, 113] == realdigits)
64 end module m1
65 !Expect: m1.mod
66 !module m1
67 !integer(4),parameter::iranges(1_8:*)=[INTEGER(4)::2_4,4_4,9_4,18_4,38_4]
68 !intrinsic::range
69 !logical(4),parameter::ircheck=.true._4
70 !intrinsic::all
71 !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]
72 !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]
73 !intrinsic::selected_int_kind
74 !intrinsic::size
75 !logical(4),parameter::ipcheck=.true._4
76 !integer(4),parameter::realprecs(1_8:*)=[INTEGER(4)::3_4,2_4,6_4,15_4,18_4,33_4]
77 !intrinsic::precision
78 !logical(4),parameter::rpreccheck=.true._4
79 !integer(4),parameter::realpvals(1_8:*)=[INTEGER(4)::0_4,3_4,4_4,6_4,7_4,15_4,16_4,18_4,19_4,33_4,34_4]
80 !integer(4),parameter::realpkinds(1_8:*)=[INTEGER(4)::2_4,2_4,4_4,4_4,8_4,8_4,10_4,10_4,16_4,16_4,-1_4]
81 !intrinsic::selected_real_kind
82 !logical(4),parameter::realpcheck=.true._4
83 !integer(4),parameter::realranges(1_8:*)=[INTEGER(4)::4_4,37_4,37_4,307_4,4931_4,4931_4]
84 !logical(4),parameter::rrangecheck=.true._4
85 !integer(4),parameter::realrvals(1_8:*)=[INTEGER(4)::0_4,4_4,5_4,37_4,38_4,307_4,308_4,4931_4,4932_4]
86 !integer(4),parameter::realrkinds(1_8:*)=[INTEGER(4)::2_4,2_4,3_4,3_4,8_4,8_4,10_4,10_4,-2_4]
87 !logical(4),parameter::realrcheck=.true._4
88 !logical(4),parameter::radixcheck=.true._4
89 !intrinsic::radix
90 !integer(4),parameter::intdigits(1_8:*)=[INTEGER(4)::7_4,15_4,31_4,63_4,127_4]
91 !intrinsic::digits
92 !logical(4),parameter::intdigitscheck=.true._4
93 !integer(4),parameter::realdigits(1_8:*)=[INTEGER(4)::11_4,8_4,24_4,53_4,64_4,113_4]
94 !logical(4),parameter::realdigitscheck=.true._4
95 !end