1 !RUN: %S/test_errors.sh %s %t %flang_fc1
6 !ERROR: Equivalence set must have more than one object
7 equivalence(i
, j
),(r(1))
17 !ERROR: Derived type component 'x%a' is not allowed in an equivalence set
19 !ERROR: Derived type component 'x%b(2)' is not allowed in an equivalence set
20 equivalence(i
, x
%b(2))
23 integer function f3(x
)
25 !ERROR: Dummy argument 'x' is not allowed in an equivalence set
27 !ERROR: Function result 'f3' is not allow in an equivalence set
33 !ERROR: Pointer 'x' is not allowed in an equivalence set
34 !ERROR: Allocatable variable 'y' is not allowed in an equivalence set
41 integer, parameter :: k
= 123
44 !ERROR: Coarray 'y' is not allowed in an equivalence set
46 !ERROR: Variable 'z' with BIND attribute is not allowed in an equivalence set
48 !ERROR: Variable 'z' with BIND attribute is not allowed in an equivalence set
49 equivalence(x(2), z(3))
50 real, bind(C
) :: z(10)
51 !ERROR: Named constant 'k' is not allowed in an equivalence set
53 !ERROR: Variable 'w' in common block with BIND attribute is not allowed in an equivalence set
59 !ERROR: Variable 'u' with TARGET attribute is not allowed in an equivalence set
75 !ERROR: Derived type object 'x1' with pointer ultimate component is not allowed in an equivalence set
77 !ERROR: Derived type object 'x2' with pointer ultimate component is not allowed in an equivalence set
86 !ERROR: Nonsequence derived type object 'x1' is not allowed in an equivalence set
96 !ERROR: Use-associated variable 'x' is not allowed in an equivalence set
98 !ERROR: Use-associated variable 'y' is not allowed in an equivalence set
105 integer, parameter :: n
= 2
107 !ERROR: Substring with nonconstant bound 'n+j' is not allowed in an equivalence set
108 equivalence(c(n
+1:n
+j
), i
)
109 !ERROR: Substring with zero length is not allowed in an equivalence set
110 equivalence(c(n
:1), i
)
111 !ERROR: Array with nonconstant subscript 'j-1' is not allowed in an equivalence set
112 equivalence(d(j
-1), i
)
113 !ERROR: Array section 'd(1:n)' is not allowed in an equivalence set
114 equivalence(d(1:n
), i
)
115 character(4) :: a(10)
116 equivalence(c
, a(10)(1:2))
117 !ERROR: 'a(10_8)(2_8:2_8)' and 'a(10_8)(1_8:1_8)' cannot have the same first storage unit
118 equivalence(c
, a(10)(2:3))
122 integer, parameter :: i(4) = [1, 2, 3, 4]
125 !ERROR: Array with vector subscript 'i' is not allowed in an equivalence set
132 !ERROR: Automatic object 'x' is not allowed in an equivalence set
139 !ERROR: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without
141 !ERROR: Equivalence set cannot contain 'a' with PROTECTED attribute and 'b' without
157 !ERROR: Equivalence set cannot contain 'b' that is character sequence type and 'a' that is not
159 !ERROR: Equivalence set cannot contain 'c' that is numeric sequence type and 'a' that is not
161 double precision :: d
163 !OK: d and e are considered to be a default kind numeric type
168 real :: a(10), b
, c
, d
169 !ERROR: 'a(2_8)' and 'a(1_8)' cannot have the same first storage unit
170 equivalence(a(1), a(2))
172 !ERROR: 'a(4_8)' and 'a(3_8)' cannot have the same first storage unit
175 !ERROR: 'a(6_8)' and 'a(5_8)' cannot have the same first storage unit
182 equivalence(a(2),b(1))
183 !ERROR: 'a(3_8)' and 'a(1_8)' cannot have the same first storage unit
184 equivalence(b(2),a(1))
191 ! There should be no error message for the following
192 equivalence (dupName
, var
)
195 subroutine interfaceSub (dupName
)
197 end subroutine interfaceSub
208 !ERROR: No explicit type declared for 'dupname'
209 equivalence (dupName
, y
)
213 ! The following implicitly declares an object called "dupName" local to
214 ! the function f17b(). OK since there's no "implicit none
215 equivalence (dupName
, y
)