| 1 |
// RUN: %clang_cc1 -verify=expected,lt50,lt51 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 2 |
// RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp -fopenmp-version=50 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 3 |
// RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 4 |
// RUN: %clang_cc1 -verify=expected,ge50,lt51,omp52 -fopenmp -fopenmp-version=52 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -verify=expected,lt50,lt51 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 7 |
// RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 8 |
// RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp-simd -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 9 |
// RUN: %clang_cc1 -verify=expected,ge50,lt51,omp52 -fopenmp-simd -fopenmp-version=52 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 10 |
|
| 11 |
void foo() { |
| 12 |
} |
| 13 |
|
| 14 |
bool foobool(int argc) { |
| 15 |
return argc; |
| 16 |
} |
| 17 |
|
| 18 |
void xxx(int argc) { |
| 19 |
int map; // expected-note {{initialize the variable 'map' to silence this warning}} |
| 20 |
#pragma omp target teams distribute map(map) // expected-warning {{variable 'map' is uninitialized when used here}} |
| 21 |
for (int i = 0; i < 10; ++i) |
| 22 |
; |
| 23 |
} |
| 24 |
|
| 25 |
struct S1; // expected-note 2 {{declared here}} // expected-note 3 {{forward declaration of 'S1'}} |
| 26 |
extern S1 a; |
| 27 |
class S2 { |
| 28 |
mutable int a; |
| 29 |
public: |
| 30 |
S2():a(0) { } |
| 31 |
S2(S2 &s2):a(s2.a) { } |
| 32 |
static float S2s; |
| 33 |
static const float S2sc; |
| 34 |
}; |
| 35 |
const float S2::S2sc = 0; |
| 36 |
const S2 b; |
| 37 |
const S2 ba[5]; |
| 38 |
class S3 { |
| 39 |
int a; |
| 40 |
public: |
| 41 |
S3():a(0) { } |
| 42 |
S3(S3 &s3):a(s3.a) { } |
| 43 |
}; |
| 44 |
const S3 c; |
| 45 |
const S3 ca[5]; |
| 46 |
extern const int f; |
| 47 |
class S4 { |
| 48 |
int a; |
| 49 |
S4(); |
| 50 |
S4(const S4 &s4); |
| 51 |
public: |
| 52 |
S4(int v):a(v) { } |
| 53 |
}; |
| 54 |
class S5 { |
| 55 |
int a; |
| 56 |
S5():a(0) {} |
| 57 |
S5(const S5 &s5):a(s5.a) { } |
| 58 |
public: |
| 59 |
S5(int v):a(v) { } |
| 60 |
}; |
| 61 |
|
| 62 |
S3 h; |
| 63 |
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} |
| 64 |
|
| 65 |
typedef int from; |
| 66 |
|
| 67 |
template <typename T, int I> // expected-note {{declared here}} |
| 68 |
T tmain(T argc) { |
| 69 |
const T d = 5; |
| 70 |
const T da[5] = { 0 }; |
| 71 |
S4 e(4); |
| 72 |
S5 g(5); |
| 73 |
T i, t[20]; |
| 74 |
T &j = i; |
| 75 |
T *k = &j; |
| 76 |
T x; |
| 77 |
T y; |
| 78 |
T to, tofrom, always; |
| 79 |
const T (&l)[5] = da; |
| 80 |
|
| 81 |
|
| 82 |
#pragma omp target teams distribute map // expected-error {{expected '(' after 'map'}} |
| 83 |
for (i = 0; i < argc; ++i) foo(); |
| 84 |
#pragma omp target teams distribute map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} |
| 85 |
for (i = 0; i < argc; ++i) foo(); |
| 86 |
#pragma omp target teams distribute map() // expected-error {{expected expression}} |
| 87 |
for (i = 0; i < argc; ++i) foo(); |
| 88 |
#pragma omp target teams distribute map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} |
| 89 |
for (i = 0; i < argc; ++i) foo(); |
| 90 |
#pragma omp target teams distribute map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} |
| 91 |
for (i = 0; i < argc; ++i) foo(); |
| 92 |
#pragma omp target teams distribute map(to:) // expected-error {{expected expression}} |
| 93 |
for (i = 0; i < argc; ++i) foo(); |
| 94 |
#pragma omp target teams distribute map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 95 |
for (i = 0; i < argc; ++i) foo(); |
| 96 |
#pragma omp target teams distribute map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} |
| 97 |
for (i = 0; i < argc; ++i) foo(); |
| 98 |
#pragma omp target teams distribute map(l[-1:]) // expected-error 2 {{array section must be a subset of the original array}} |
| 99 |
for (i = 0; i < argc; ++i) foo(); |
| 100 |
#pragma omp target teams distribute map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} |
| 101 |
for (i = 0; i < argc; ++i) foo(); |
| 102 |
#pragma omp target teams distribute map(l[true:true]) |
| 103 |
for (i = 0; i < argc; ++i) foo(); |
| 104 |
#pragma omp target teams distribute map(x) |
| 105 |
for (i = 0; i < argc; ++i) foo(); |
| 106 |
#pragma omp target teams distribute map(tofrom: t[:I]) |
| 107 |
for (i = 0; i < argc; ++i) foo(); |
| 108 |
#pragma omp target teams distribute map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} expected-error {{incomplete type 'S1' where a complete type is required}} |
| 109 |
for (i = 0; i < argc; ++i) foo(); |
| 110 |
#pragma omp target teams distribute map(T) // expected-error {{'T' does not refer to a value}} |
| 111 |
for (i = 0; i < argc; ++i) foo(); |
| 112 |
// ge50-error@+2 2 {{expected addressable lvalue in 'map' clause}} |
| 113 |
// lt50-error@+1 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 114 |
#pragma omp target teams distribute map(I) |
| 115 |
for (i = 0; i < argc; ++i) foo(); |
| 116 |
#pragma omp target teams distribute map(S2::S2s) |
| 117 |
for (i = 0; i < argc; ++i) foo(); |
| 118 |
#pragma omp target teams distribute map(S2::S2sc) |
| 119 |
for (i = 0; i < argc; ++i) foo(); |
| 120 |
#pragma omp target teams distribute map(x) |
| 121 |
for (i = 0; i < argc; ++i) foo(); |
| 122 |
#pragma omp target teams distribute map(to: x) |
| 123 |
for (i = 0; i < argc; ++i) foo(); |
| 124 |
#pragma omp target teams distribute map(to: to) |
| 125 |
for (i = 0; i < argc; ++i) foo(); |
| 126 |
#pragma omp target teams distribute map(to) |
| 127 |
for (i = 0; i < argc; ++i) foo(); |
| 128 |
#pragma omp target teams distribute map(to, x) |
| 129 |
for (i = 0; i < argc; ++i) foo(); |
| 130 |
#pragma omp target teams distribute map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 131 |
for (i = 0; i < argc; ++i) foo(); |
| 132 |
// ge50-error@+3 2 {{expected addressable lvalue in 'map' clause}} |
| 133 |
// lt50-error@+2 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 134 |
#pragma omp target teams distribute map(tofrom \ |
| 135 |
: argc > 0 ? x : y) |
| 136 |
for (i = 0; i < argc; ++i) foo(); |
| 137 |
#pragma omp target teams distribute map(argc) |
| 138 |
for (i = 0; i < argc; ++i) foo(); |
| 139 |
#pragma omp target teams distribute map(S1) // expected-error {{'S1' does not refer to a value}} |
| 140 |
for (i = 0; i < argc; ++i) foo(); |
| 141 |
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 142 |
for (i = 0; i < argc; ++i) foo(); |
| 143 |
#pragma omp target teams distribute map(ba) |
| 144 |
for (i = 0; i < argc; ++i) foo(); |
| 145 |
#pragma omp target teams distribute map(ca) |
| 146 |
for (i = 0; i < argc; ++i) foo(); |
| 147 |
#pragma omp target teams distribute map(da) |
| 148 |
for (i = 0; i < argc; ++i) foo(); |
| 149 |
#pragma omp target teams distribute map(S2::S2s) |
| 150 |
for (i = 0; i < argc; ++i) foo(); |
| 151 |
#pragma omp target teams distribute map(S2::S2sc) |
| 152 |
for (i = 0; i < argc; ++i) foo(); |
| 153 |
#pragma omp target teams distribute map(e, g) |
| 154 |
for (i = 0; i < argc; ++i) foo(); |
| 155 |
#pragma omp target teams distribute map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} |
| 156 |
for (i = 0; i < argc; ++i) foo(); |
| 157 |
#pragma omp target teams distribute map(k), map(k) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}} |
| 158 |
for (i = 0; i < argc; ++i) foo(); |
| 159 |
#pragma omp target teams distribute map(k), map(k[:5]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} lt50-note 2 {{used here}} |
| 160 |
for (i = 0; i < argc; ++i) foo(); |
| 161 |
#pragma omp target teams distribute map(da) |
| 162 |
for (i = 0; i < argc; ++i) foo(); |
| 163 |
#pragma omp target teams distribute map(da[:4]) |
| 164 |
for (i = 0; i < argc; ++i) foo(); |
| 165 |
#pragma omp target data map(k, j, l) // lt50-note 2 {{used here}} |
| 166 |
#pragma omp target teams distribute map(k[:4]) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} |
| 167 |
for (i = 0; i < argc; ++i) foo(); |
| 168 |
#pragma omp target teams distribute map(j) |
| 169 |
for (i = 0; i < argc; ++i) foo(); |
| 170 |
#pragma omp target teams distribute map(l) map(l[:5]) // lt50-error 2 {{variable already marked as mapped in current construct}} lt50-note 2 {{used here}} |
| 171 |
for (i = 0; i < argc; ++i) foo(); |
| 172 |
#pragma omp target data map(k[:4], j, l[:5]) // lt50-note 2 {{used here}} |
| 173 |
{ |
| 174 |
#pragma omp target teams distribute map(k) // lt50-error 2 {{pointer cannot be mapped along with a section derived from itself}} |
| 175 |
for (i = 0; i < argc; ++i) |
| 176 |
foo(); |
| 177 |
#pragma omp target teams distribute map(j) |
| 178 |
for (i = 0; i < argc; ++i) foo(); |
| 179 |
#pragma omp target teams distribute map(l) |
| 180 |
for (i = 0; i < argc; ++i) foo(); |
| 181 |
} |
| 182 |
|
| 183 |
#pragma omp target teams distribute map(always, tofrom: x) |
| 184 |
for (i = 0; i < argc; ++i) foo(); |
| 185 |
#pragma omp target teams distribute map(always: x) // expected-error {{missing map type}} |
| 186 |
for (i = 0; i < argc; ++i) foo(); |
| 187 |
// ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}} |
| 188 |
// lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}} |
| 189 |
// expected-error@+1 {{missing map type}} |
| 190 |
#pragma omp target teams distribute map(tofrom, always: x) |
| 191 |
for (i = 0; i < argc; ++i) foo(); |
| 192 |
#pragma omp target teams distribute map(always, tofrom: always, tofrom, x) |
| 193 |
for (i = 0; i < argc; ++i) foo(); |
| 194 |
#pragma omp target teams distribute map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 195 |
for (i = 0; i < argc; ++i) foo(); |
| 196 |
|
| 197 |
return 0; |
| 198 |
} |
| 199 |
|
| 200 |
int main(int argc, char **argv) { |
| 201 |
const int d = 5; |
| 202 |
const int da[5] = { 0 }; |
| 203 |
S4 e(4); |
| 204 |
S5 g(5); |
| 205 |
int i; |
| 206 |
int &j = i; |
| 207 |
int *k = &j; |
| 208 |
int x; |
| 209 |
int y; |
| 210 |
int to, tofrom, always; |
| 211 |
const int (&l)[5] = da; |
| 212 |
|
| 213 |
#pragma omp target teams distribute map // expected-error {{expected '(' after 'map'}} |
| 214 |
for (i = 0; i < argc; ++i) foo(); |
| 215 |
#pragma omp target teams distribute map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} |
| 216 |
for (i = 0; i < argc; ++i) foo(); |
| 217 |
#pragma omp target teams distribute map() // expected-error {{expected expression}} |
| 218 |
for (i = 0; i < argc; ++i) foo(); |
| 219 |
#pragma omp target teams distribute map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} |
| 220 |
for (i = 0; i < argc; ++i) foo(); |
| 221 |
#pragma omp target teams distribute map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} |
| 222 |
for (i = 0; i < argc; ++i) foo(); |
| 223 |
#pragma omp target teams distribute map(to:) // expected-error {{expected expression}} |
| 224 |
for (i = 0; i < argc; ++i) foo(); |
| 225 |
#pragma omp target teams distribute map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 226 |
for (i = 0; i < argc; ++i) foo(); |
| 227 |
#pragma omp target teams distribute map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} |
| 228 |
for (i = 0; i < argc; ++i) foo(); |
| 229 |
#pragma omp target teams distribute map(l[-1:]) // expected-error {{array section must be a subset of the original array}} |
| 230 |
for (i = 0; i < argc; ++i) foo(); |
| 231 |
#pragma omp target teams distribute map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} |
| 232 |
for (i = 0; i < argc; ++i) foo(); |
| 233 |
#pragma omp target teams distribute map(l[true:true]) |
| 234 |
for (i = 0; i < argc; ++i) foo(); |
| 235 |
#pragma omp target teams distribute map(x) |
| 236 |
for (i = 0; i < argc; ++i) foo(); |
| 237 |
#pragma omp target teams distribute map(to: x) |
| 238 |
for (i = 0; i < argc; ++i) foo(); |
| 239 |
#pragma omp target teams distribute map(to: to) |
| 240 |
for (i = 0; i < argc; ++i) foo(); |
| 241 |
#pragma omp target teams distribute map(to) |
| 242 |
for (i = 0; i < argc; ++i) foo(); |
| 243 |
#pragma omp target teams distribute map(to, x) |
| 244 |
for (i = 0; i < argc; ++i) foo(); |
| 245 |
#pragma omp target teams distribute map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 246 |
for (i = 0; i < argc; ++i) |
| 247 |
foo(); |
| 248 |
// ge50-error@+3 {{expected addressable lvalue in 'map' clause}} |
| 249 |
// lt50-error@+2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 250 |
#pragma omp target teams distribute map(tofrom \ |
| 251 |
: argc > 0 ? argv[1] : argv[2]) |
| 252 |
for (i = 0; i < argc; ++i) foo(); |
| 253 |
#pragma omp target teams distribute map(argc) |
| 254 |
for (i = 0; i < argc; ++i) foo(); |
| 255 |
#pragma omp target teams distribute map(S1) // expected-error {{'S1' does not refer to a value}} |
| 256 |
for (i = 0; i < argc; ++i) foo(); |
| 257 |
#pragma omp target teams distribute map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 258 |
for (i = 0; i < argc; ++i) foo(); |
| 259 |
#pragma omp target teams distribute map(argv[1]) |
| 260 |
for (i = 0; i < argc; ++i) foo(); |
| 261 |
#pragma omp target teams distribute map(ba) |
| 262 |
for (i = 0; i < argc; ++i) foo(); |
| 263 |
#pragma omp target teams distribute map(ca) |
| 264 |
for (i = 0; i < argc; ++i) foo(); |
| 265 |
#pragma omp target teams distribute map(da) |
| 266 |
for (i = 0; i < argc; ++i) foo(); |
| 267 |
#pragma omp target teams distribute map(S2::S2s) |
| 268 |
for (i = 0; i < argc; ++i) foo(); |
| 269 |
#pragma omp target teams distribute map(S2::S2sc) |
| 270 |
for (i = 0; i < argc; ++i) foo(); |
| 271 |
#pragma omp target teams distribute map(e, g) |
| 272 |
for (i = 0; i < argc; ++i) foo(); |
| 273 |
#pragma omp target teams distribute map(h) // expected-error {{threadprivate variables are not allowed in 'map' clause}} |
| 274 |
for (i = 0; i < argc; ++i) foo(); |
| 275 |
#pragma omp target teams distribute map(k), map(k) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 276 |
for (i = 0; i < argc; ++i) foo(); |
| 277 |
#pragma omp target teams distribute map(k), map(k[:5]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} lt50-note {{used here}} |
| 278 |
for (i = 0; i < argc; ++i) foo(); |
| 279 |
#pragma omp target teams distribute map(da) |
| 280 |
for (i = 0; i < argc; ++i) foo(); |
| 281 |
#pragma omp target teams distribute map(da[:4]) |
| 282 |
for (i = 0; i < argc; ++i) foo(); |
| 283 |
#pragma omp target data map(k, j, l) // lt50-note {{used here}} |
| 284 |
#pragma omp target teams distribute map(k[:4]) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} |
| 285 |
for (i = 0; i < argc; ++i) foo(); |
| 286 |
#pragma omp target teams distribute map(j) |
| 287 |
for (i = 0; i < argc; ++i) foo(); |
| 288 |
#pragma omp target teams distribute map(l) map(l[:5]) // lt50-error {{variable already marked as mapped in current construct}} lt50-note {{used here}} |
| 289 |
for (i = 0; i < argc; ++i) foo(); |
| 290 |
#pragma omp target data map(k[:4], j, l[:5]) // lt50-note {{used here}} |
| 291 |
{ |
| 292 |
#pragma omp target teams distribute map(k) // lt50-error {{pointer cannot be mapped along with a section derived from itself}} |
| 293 |
for (i = 0; i < argc; ++i) |
| 294 |
foo(); |
| 295 |
#pragma omp target teams distribute map(j) |
| 296 |
for (i = 0; i < argc; ++i) foo(); |
| 297 |
#pragma omp target teams distribute map(l) |
| 298 |
for (i = 0; i < argc; ++i) foo(); |
| 299 |
} |
| 300 |
|
| 301 |
#pragma omp target teams distribute map(always, tofrom: x) |
| 302 |
for (i = 0; i < argc; ++i) foo(); |
| 303 |
#pragma omp target teams distribute map(always: x) // expected-error {{missing map type}} |
| 304 |
for (i = 0; i < argc; ++i) foo(); |
| 305 |
// ge51-error@+3 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper', 'present'}} |
| 306 |
// lt51-error@+2 {{incorrect map type modifier, expected one of: 'always', 'close', 'mapper'}} |
| 307 |
// expected-error@+1 {{missing map type}} |
| 308 |
#pragma omp target teams distribute map(tofrom, always: x) |
| 309 |
for (i = 0; i < argc; ++i) foo(); |
| 310 |
#pragma omp target teams distribute map(always, tofrom: always, tofrom, x) |
| 311 |
for (i = 0; i < argc; ++i) foo(); |
| 312 |
#pragma omp target teams distribute map(always close tofrom: x) // omp52-error 2 {{missing ',' after map type modifier}} |
| 313 |
for (i = 0; i < argc; ++i) foo(); |
| 314 |
#pragma omp target teams distribute map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} |
| 315 |
for (i = 0; i < argc; ++i) foo(); |
| 316 |
#pragma omp target teams distribute map(delete: j) // expected-error {{map type 'delete' is not allowed for '#pragma omp target teams distribute'}} |
| 317 |
for (i = 0; i < argc; ++i) |
| 318 |
foo(); |
| 319 |
#pragma omp target teams distribute map(release: j) // expected-error {{map type 'release' is not allowed for '#pragma omp target teams distribute'}} |
| 320 |
for (i = 0; i < argc; ++i) |
| 321 |
foo(); |
| 322 |
|
| 323 |
return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}} |
| 324 |
} |
| 325 |
|