[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve104.f90
blob48fe9653c821ed4898209ae1412c53ed8cf97d46
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Test constant folding of type parameter values both a base value and a
4 ! parameter name are supplied.
5 !
6 ! Type parameters are described in 7.5.3 and constant expressions are described
7 ! in 10.1.12. 10.1.12, paragraph 4 defines whether a specification inquiry is
8 ! a constant expression. Section 10.1.11, paragraph 3, item (2) states that a
9 ! type parameter inquiry is a specification inquiry.
11 module m1
12 type dtype(goodDefaultKind, badDefaultKind)
13 integer, kind :: goodDefaultKind = 4
14 integer, kind :: badDefaultKind = 343
15 ! next field OK only if instantiated with a good value of goodDefaultKind
16 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
17 real(goodDefaultKind) :: goodDefaultField
18 ! next field OK only if instantiated with a good value of goodDefaultKind
19 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
20 !ERROR: KIND parameter value (99) of intrinsic type REAL did not resolve to a supported value
21 real(badDefaultKind) :: badDefaultField
22 end type dtype
23 type(dtype) :: v1
24 type(dtype(4, 4)) :: v2
25 type(dtype(99, 4)) :: v3
26 type(dtype(4, 99)) :: v4
27 end module m1
29 module m2
30 type baseType(baseParam)
31 integer, kind :: baseParam = 4
32 end type baseType
33 type dtype(dtypeParam)
34 integer, kind :: dtypeParam = 4
35 type(baseType(dtypeParam)) :: baseField
36 !ERROR: KIND parameter value (343) of intrinsic type REAL did not resolve to a supported value
37 real(baseField%baseParam) :: realField
38 end type dtype
40 type(dtype) :: v1
41 type(dtype(8)) :: v2
42 type(dtype(343)) :: v3
43 end module m2
45 module m3
46 type dtype(goodDefaultLen, badDefaultLen)
47 integer, len :: goodDefaultLen = 4
48 integer, len :: badDefaultLen = 343
49 end type dtype
50 type(dtype) :: v1
51 type(dtype(4, 4)) :: v2
52 type(dtype(99, 4)) :: v3
53 type(dtype(4, 99)) :: v4
54 real(v1%goodDefaultLen), pointer :: pGood1
55 !ERROR: REAL(KIND=343) is not a supported type
56 real(v1%badDefaultLen), pointer :: pBad1
57 real(v2%goodDefaultLen), pointer :: pGood2
58 real(v2%badDefaultLen), pointer :: pBad2
59 !ERROR: REAL(KIND=99) is not a supported type
60 real(v3%goodDefaultLen), pointer :: pGood3
61 real(v3%badDefaultLen), pointer :: pBad3
62 real(v4%goodDefaultLen), pointer :: pGood4
63 !ERROR: REAL(KIND=99) is not a supported type
64 real(v4%badDefaultLen), pointer :: pBad4
65 end module m3