File: declare-target02.f90

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (206 lines) | stat: -rw-r--r-- 9,276 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52
! OpenMP Version 5.1
! Check OpenMP construct validity for the following directives:
! 2.14.7 Declare Target Directive

program declare_target02
  integer :: arr1(10), arr1_to(10), arr1_link(10)
  common /blk1/ a1, a1_to, a1_link
  real, save :: eq_a, eq_b, eq_c, eq_d


  !$omp declare target (arr1)

  !$omp declare target (blk1)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a1)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !$omp declare target to (arr1_to)

  !$omp declare target enter (arr1_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !$omp declare target to (blk1_to)

  !$omp declare target enter (blk1_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a1_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target enter (a1_to)

  !$omp declare target link (arr1_link)

  !$omp declare target link (blk1_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a1_link)

  equivalence(eq_a, eq_b)
  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target (eq_a)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target to (eq_a)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target enter (eq_a)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target link (eq_b)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target (eq_c)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target to (eq_c)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target enter (eq_c)

  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
  !$omp declare target link (eq_d)
  equivalence(eq_c, eq_d)

contains
  subroutine func()
    integer :: arr2(10), arr2_to(10), arr2_link(10)
    integer, save :: arr3(10), arr3_to(10), arr3_link(10)
    common /blk2/ a2, a2_to, a2_link
    common /blk3/ a3, a3_to, a3_link
    save /blk3/

    !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
    !$omp declare target (arr2)

    !$omp declare target (arr3)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target (a2)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target (a3)

    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
    !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
    !$omp declare target to (arr2_to)

    !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
    !$omp declare target enter (arr2_to)

    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
    !$omp declare target to (arr3_to)

    !$omp declare target enter (arr3_to)

    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target to (a2_to)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target enter (a2_to)

    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target to (a3_to)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target enter (a3_to)

    !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
    !$omp declare target link (arr2_link)

    !$omp declare target link (arr3_link)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target link (a2_link)

    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
    !$omp declare target link (a3_link)
  end
end

module mod4
  integer :: arr4(10), arr4_to(10), arr4_link(10)
  common /blk4/ a4, a4_to, a4_link

  !$omp declare target (arr4)

  !$omp declare target (blk4)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a4)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !$omp declare target to (arr4_to)

  !$omp declare target enter (arr4_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !$omp declare target to (blk4_to)
  !$omp declare target enter (blk4_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a4_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target enter (a4_to)

  !$omp declare target link (arr4_link)

  !$omp declare target link (blk4_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a4_link)
end

subroutine func5()
  integer :: arr5(10), arr5_to(10), arr5_link(10)
  common /blk5/ a5, a5_to, a5_link

  !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
  !$omp declare target (arr5)

  !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
  !$omp declare target (blk5)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target (a5)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !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
  !$omp declare target to (arr5_to)
  
  !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
  !$omp declare target enter (arr5_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !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
  !$omp declare target to (blk5_to)

  !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
  !$omp declare target enter (blk5_to)

  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target to (a5_to)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target enter (a5_to)

  !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
  !$omp declare target link (arr5_link)

  !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
  !$omp declare target link (blk5_link)

  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
  !$omp declare target link (a5_link)
end