1 !RUN: not %flang_fc1 -pedantic %s 2>&1 | FileCheck %s
5 !CHECK: error: Equivalence set must have more than one object
6 equivalence(i
, j
),(r(1))
16 !CHECK: error: Derived type component 'x%a' is not allowed in an equivalence set
18 !CHECK: error: Derived type component 'x%b(2)' is not allowed in an equivalence set
19 equivalence(i
, x
%b(2))
22 integer function f3(x
)
24 !CHECK: error: Dummy argument 'x' is not allowed in an equivalence set
26 !CHECK: error: Function result 'f3' is not allow in an equivalence set
32 !CHECK: error: Pointer 'x' is not allowed in an equivalence set
33 !CHECK: error: Allocatable variable 'y' is not allowed in an equivalence set
40 integer, parameter :: k
= 123
43 !CHECK: error: Coarray 'y' is not allowed in an equivalence set
45 !CHECK: error: Variable 'z' with BIND attribute is not allowed in an equivalence set
47 !CHECK: error: Variable 'z' with BIND attribute is not allowed in an equivalence set
48 equivalence(x(2), z(3))
49 real, bind(C
) :: z(10)
50 !CHECK: error: Named constant 'k' is not allowed in an equivalence set
52 !CHECK: error: Variable 'w' in common block with BIND attribute is not allowed in an equivalence set
58 !CHECK: error: Variable 'u' with TARGET attribute is not allowed in an equivalence set
74 !CHECK: error: Derived type object 'x1' with pointer ultimate component is not allowed in an equivalence set
76 !CHECK: error: Derived type object 'x2' with pointer ultimate component is not allowed in an equivalence set
85 !CHECK: error: Nonsequence derived type object 'x1' is not allowed in an equivalence set
95 !CHECK: error: Use-associated variable 'x' is not allowed in an equivalence set
97 !CHECK: error: Use-associated variable 'y' is not allowed in an equivalence set
104 integer, parameter :: n
= 2
106 !CHECK: error: Substring with nonconstant bound 'n+j' is not allowed in an equivalence set
107 equivalence(c(n
+1:n
+j
), i
)
108 !CHECK: error: Substring with zero length is not allowed in an equivalence set
109 equivalence(c(n
:1), i
)
110 !CHECK: error: Array with nonconstant subscript 'j-1' is not allowed in an equivalence set
111 equivalence(d(j
-1), i
)
112 !CHECK: error: Array section 'd(1:n)' is not allowed in an equivalence set
113 equivalence(d(1:n
), i
)
114 character(4) :: a(10)
115 equivalence(c
, a(10)(1:2))
116 !CHECK: error: 'a(10_8)(2_8:2_8)' and 'a(10_8)(1_8:1_8)' cannot have the same first storage unit
117 equivalence(c
, a(10)(2:3))
121 integer, parameter :: i(4) = [1, 2, 3, 4]
124 !CHECK: error: Array with vector subscript 'i' is not allowed in an equivalence set
131 !CHECK: error: Automatic object 'x' is not allowed in an equivalence set
138 !CHECK: error: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without
140 !CHECK: error: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without
156 !CHECK: nonstandard: Equivalence set contains 'a' that is numeric sequence type and 'b' that is character
158 !CHECK: nonstandard: Equivalence set contains 'c' that is a default numeric sequence type and 'a' that is numeric with non-default kind
160 double precision :: d
162 !OK: d and e are considered to be a default kind numeric type
176 !CHECK: nonstandard: Equivalence set contains 's' and 'r' with same type that is neither numeric nor character sequence type
178 !CHECK: error: Equivalence set cannot contain 's' and 't' with distinct types that are not both numeric or character sequence types
183 real :: a(10), b
, c
, d
184 !CHECK: error: 'a(2_8)' and 'a(1_8)' cannot have the same first storage unit
185 equivalence(a(1), a(2))
187 !CHECK: error: 'a(4_8)' and 'a(3_8)' cannot have the same first storage unit
190 !CHECK: error: 'a(6_8)' and 'a(5_8)' cannot have the same first storage unit
197 equivalence(a(2),b(1))
198 !CHECK: error: 'a(3_8)' and 'a(1_8)' cannot have the same first storage unit
199 equivalence(b(2),a(1))
206 ! There should be no error message for the following
207 equivalence (dupName
, var
)
210 subroutine interfaceSub (dupName
)
212 end subroutine interfaceSub
223 !CHECK: error: No explicit type declared for 'dupname'
224 equivalence (dupName
, y
)
228 ! The following implicitly declares an object called "dupName" local to
229 ! the function f17b(). OK since there's no "implicit none
230 equivalence (dupName
, y
)
235 ! Regression test: don't loop when checking mutually-referencing types
238 type (t2
), pointer :: p
242 type (t1
), pointer :: p
250 !ERROR: 'e19' in equivalence set is not a data object
252 !ERROR: 'e20' in equivalence set is not a data object