[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / declare-target02.f90
blob0f12180587f838a09bbd2656823d14aee4522e40
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52
2 ! OpenMP Version 5.1
3 ! Check OpenMP construct validity for the following directives:
4 ! 2.14.7 Declare Target Directive
6 program declare_target02
7 integer :: arr1(10), arr1_to(10), arr1_link(10)
8 common /blk1/ a1, a1_to, a1_link
9 real, save :: eq_a, eq_b, eq_c, eq_d
12 !$omp declare target (arr1)
14 !$omp declare target (blk1)
16 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
17 !$omp declare target (a1)
19 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
20 !$omp declare target to (arr1_to)
22 !$omp declare target enter (arr1_to)
24 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
25 !$omp declare target to (blk1_to)
27 !$omp declare target enter (blk1_to)
29 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
30 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
31 !$omp declare target to (a1_to)
33 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
34 !$omp declare target enter (a1_to)
36 !$omp declare target link (arr1_link)
38 !$omp declare target link (blk1_link)
40 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
41 !$omp declare target link (a1_link)
43 equivalence(eq_a, eq_b)
44 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
45 !$omp declare target (eq_a)
47 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
48 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
49 !$omp declare target to (eq_a)
51 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
52 !$omp declare target enter (eq_a)
54 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
55 !$omp declare target link (eq_b)
57 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
58 !$omp declare target (eq_c)
60 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
61 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
62 !$omp declare target to (eq_c)
64 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
65 !$omp declare target enter (eq_c)
67 !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
68 !$omp declare target link (eq_d)
69 equivalence(eq_c, eq_d)
71 contains
72 subroutine func()
73 integer :: arr2(10), arr2_to(10), arr2_link(10)
74 integer, save :: arr3(10), arr3_to(10), arr3_link(10)
75 common /blk2/ a2, a2_to, a2_link
76 common /blk3/ a3, a3_to, a3_link
77 save /blk3/
79 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
80 !$omp declare target (arr2)
82 !$omp declare target (arr3)
84 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
85 !$omp declare target (a2)
87 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
88 !$omp declare target (a3)
90 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
91 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
92 !$omp declare target to (arr2_to)
94 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
95 !$omp declare target enter (arr2_to)
97 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
98 !$omp declare target to (arr3_to)
100 !$omp declare target enter (arr3_to)
102 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
103 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
104 !$omp declare target to (a2_to)
106 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
107 !$omp declare target enter (a2_to)
109 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
110 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
111 !$omp declare target to (a3_to)
113 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
114 !$omp declare target enter (a3_to)
116 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
117 !$omp declare target link (arr2_link)
119 !$omp declare target link (arr3_link)
121 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
122 !$omp declare target link (a2_link)
124 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
125 !$omp declare target link (a3_link)
129 module mod4
130 integer :: arr4(10), arr4_to(10), arr4_link(10)
131 common /blk4/ a4, a4_to, a4_link
133 !$omp declare target (arr4)
135 !$omp declare target (blk4)
137 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
138 !$omp declare target (a4)
140 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
141 !$omp declare target to (arr4_to)
143 !$omp declare target enter (arr4_to)
145 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
146 !$omp declare target to (blk4_to)
147 !$omp declare target enter (blk4_to)
149 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
150 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
151 !$omp declare target to (a4_to)
153 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
154 !$omp declare target enter (a4_to)
156 !$omp declare target link (arr4_link)
158 !$omp declare target link (blk4_link)
160 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
161 !$omp declare target link (a4_link)
164 subroutine func5()
165 integer :: arr5(10), arr5_to(10), arr5_link(10)
166 common /blk5/ a5, a5_to, a5_link
168 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
169 !$omp declare target (arr5)
171 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
172 !$omp declare target (blk5)
174 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
175 !$omp declare target (a5)
177 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
178 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
179 !$omp declare target to (arr5_to)
181 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
182 !$omp declare target enter (arr5_to)
184 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
185 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
186 !$omp declare target to (blk5_to)
188 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
189 !$omp declare target enter (blk5_to)
191 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
192 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
193 !$omp declare target to (a5_to)
195 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
196 !$omp declare target enter (a5_to)
198 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
199 !$omp declare target link (arr5_link)
201 !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
202 !$omp declare target link (blk5_link)
204 !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
205 !$omp declare target link (a5_link)