| 1 |
// RUN: %clang_cc1 -verify=expected,le51 -fopenmp -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 2 |
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp -fopenmp-version=40 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 3 |
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 4 |
|
| 5 |
// RUN: %clang_cc1 -verify=expected,le51 -fopenmp-simd -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 6 |
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd -fopenmp-version=40 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 7 |
// RUN: %clang_cc1 -verify=expected,le45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wno-openmp-mapping -Wuninitialized |
| 8 |
|
| 9 |
void foo() { |
| 10 |
} |
| 11 |
|
| 12 |
bool foobool(int argc) { |
| 13 |
return argc; |
| 14 |
} |
| 15 |
|
| 16 |
struct S1; // expected-note 2 {{declared here}} // expected-note 2 {{forward declaration of 'S1'}} |
| 17 |
extern S1 a; |
| 18 |
class S2 { |
| 19 |
mutable int a; |
| 20 |
public: |
| 21 |
S2():a(0) { } |
| 22 |
S2(S2 &s2):a(s2.a) { } |
| 23 |
static float S2s; |
| 24 |
static const float S2sc; |
| 25 |
}; |
| 26 |
const float S2::S2sc = 0; |
| 27 |
const S2 b; |
| 28 |
const S2 ba[5]; |
| 29 |
class S3 { |
| 30 |
int a; |
| 31 |
public: |
| 32 |
S3():a(0) { } |
| 33 |
S3(S3 &s3):a(s3.a) { } |
| 34 |
}; |
| 35 |
const S3 c; |
| 36 |
const S3 ca[5]; |
| 37 |
extern const int f; |
| 38 |
class S4 { |
| 39 |
int a; |
| 40 |
S4(); |
| 41 |
S4(const S4 &s4); |
| 42 |
public: |
| 43 |
S4(int v):a(v) { } |
| 44 |
}; |
| 45 |
class S5 { |
| 46 |
int a; |
| 47 |
S5():a(0) {} |
| 48 |
S5(const S5 &s5):a(s5.a) { } |
| 49 |
public: |
| 50 |
S5(int v):a(v) { } |
| 51 |
}; |
| 52 |
struct S6 { |
| 53 |
int ii; |
| 54 |
int aa[30]; |
| 55 |
float xx; |
| 56 |
double *pp; |
| 57 |
}; |
| 58 |
struct S7 { |
| 59 |
int i; |
| 60 |
int a[50]; |
| 61 |
float x; |
| 62 |
S6 s6[5]; |
| 63 |
double *p; |
| 64 |
unsigned bfa : 4; |
| 65 |
}; |
| 66 |
struct S8 { |
| 67 |
int *ptr; |
| 68 |
int a; |
| 69 |
struct S7* S; |
| 70 |
void foo() { |
| 71 |
#pragma omp target update to(*this) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 72 |
{} |
| 73 |
#pragma omp target update to(*(this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 74 |
#pragma omp target update to(*(this->S->i+this->S->p)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 75 |
#pragma omp target update to(*(this->S->i+this->S->s6[0].pp)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 76 |
#pragma omp target update to(*(a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 77 |
#pragma omp target update to(*(*(this->ptr)+a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 78 |
#pragma omp target update to(*(this+this)) // expected-error {{invalid operands to binary expression ('S8 *' and 'S8 *')}} |
| 79 |
{} |
| 80 |
|
| 81 |
double marr[10][5][10]; |
| 82 |
#pragma omp target update to(marr [0:1][2:4][1:2]) // le45-error {{array section does not specify contiguous storage}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 83 |
{} |
| 84 |
} |
| 85 |
}; |
| 86 |
|
| 87 |
S3 h; |
| 88 |
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} |
| 89 |
|
| 90 |
typedef int from; |
| 91 |
|
| 92 |
template <typename T, int I> // expected-note {{declared here}} |
| 93 |
T tmain(T argc) { |
| 94 |
const T d = 5; |
| 95 |
const T da[5] = { 0 }; |
| 96 |
S4 e(4); |
| 97 |
S5 g(5); |
| 98 |
T *m; |
| 99 |
T i, t[20]; |
| 100 |
T &j = i; |
| 101 |
T *k = &j; |
| 102 |
T x; |
| 103 |
T y; |
| 104 |
T to; |
| 105 |
const T (&l)[5] = da; |
| 106 |
S7 s7; |
| 107 |
|
| 108 |
#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 109 |
#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 110 |
#pragma omp target update to() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 111 |
#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 112 |
#pragma omp target update to(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 113 |
#pragma omp target update to(x) |
| 114 |
#pragma omp target update to(t[:I]) |
| 115 |
#pragma omp target update to(T) // expected-error {{'T' does not refer to a value}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 116 |
#pragma omp target update to(I) // le51-error 2 {{expected addressable lvalue in 'to' clause}} le45-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 117 |
#pragma omp target update to(S2::S2s) |
| 118 |
#pragma omp target update to(S2::S2sc) |
| 119 |
#pragma omp target update to(to) |
| 120 |
#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}} |
| 121 |
#pragma omp target update to(argc > 0 ? x : y) // le51-error 2 {{expected addressable lvalue in 'to' clause}} le45-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 122 |
#pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 123 |
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 124 |
#pragma omp target update to(ba) |
| 125 |
#pragma omp target update to(h) // expected-error {{threadprivate variables are not allowed in 'to' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 126 |
#pragma omp target update to(k), from(k) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}} |
| 127 |
#pragma omp target update to(t), to(t[:5]) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}} |
| 128 |
#pragma omp target update to(da) |
| 129 |
#pragma omp target update to(da[:4]) |
| 130 |
|
| 131 |
#pragma omp target update to(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}} |
| 132 |
#pragma omp target update to(x, c[:]) // expected-error {{subscripted value is not an array or pointer}} |
| 133 |
#pragma omp target update to(x, (m+1)[2]) // le45-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 134 |
#pragma omp target update to(s7.i, s7.a[:3]) |
| 135 |
#pragma omp target update to(s7.s6[1].aa[0:5]) |
| 136 |
#pragma omp target update to(x, s7.s6[:5].aa[6]) // expected-error {{OpenMP array section is not allowed here}} |
| 137 |
#pragma omp target update to(x, s7.s6[:5].aa[:6]) // expected-error {{OpenMP array section is not allowed here}} |
| 138 |
#pragma omp target update to(s7.p[:10]) |
| 139 |
#pragma omp target update to(x, s7.bfa) // expected-error {{bit fields cannot be used to specify storage in a 'to' clause}} |
| 140 |
#pragma omp target update to(x, s7.p[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 141 |
#pragma omp target data map(to: s7.i) |
| 142 |
{ |
| 143 |
#pragma omp target update to(s7.x) |
| 144 |
} |
| 145 |
return 0; |
| 146 |
} |
| 147 |
|
| 148 |
int main(int argc, char **argv) { |
| 149 |
const int d = 5; |
| 150 |
const int da[5] = { 0 }; |
| 151 |
S4 e(4); |
| 152 |
S5 g(5); |
| 153 |
int i, t[20]; |
| 154 |
int &j = i; |
| 155 |
int *k = &j; |
| 156 |
int x; |
| 157 |
int y; |
| 158 |
int to; |
| 159 |
const int (&l)[5] = da; |
| 160 |
S7 s7; |
| 161 |
int *m; |
| 162 |
int **BB, *offset; |
| 163 |
int ***BBB; |
| 164 |
|
| 165 |
#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 166 |
#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 167 |
#pragma omp target update to() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 168 |
#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 169 |
#pragma omp target update to(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 170 |
#pragma omp target update to(x) |
| 171 |
#pragma omp target update to(t[:i]) |
| 172 |
#pragma omp target update to(S2::S2s) |
| 173 |
#pragma omp target update to(S2::S2sc) |
| 174 |
#pragma omp target update to(to) |
| 175 |
#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}} |
| 176 |
#pragma omp target update to(argc > 0 ? x : y) // le51-error {{expected addressable lvalue in 'to' clause}} le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 177 |
#pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 178 |
#pragma omp target update to(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} |
| 179 |
#pragma omp target update to(ba) |
| 180 |
#pragma omp target update to(h) // expected-error {{threadprivate variables are not allowed in 'to' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 181 |
#pragma omp target update to(k), from(k) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}} |
| 182 |
#pragma omp target update to(t), to(t[:5]) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}} |
| 183 |
#pragma omp target update to(da) |
| 184 |
#pragma omp target update to(da[:4]) |
| 185 |
|
| 186 |
#pragma omp target update to(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}} |
| 187 |
#pragma omp target update to(x, c[:]) // expected-error {{subscripted value is not an array or pointer}} |
| 188 |
#pragma omp target update to(x, (m+1)[2]) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} |
| 189 |
#pragma omp target update to(s7.i, s7.a[:3]) |
| 190 |
#pragma omp target update to(s7.s6[1].aa[0:5]) |
| 191 |
#pragma omp target update to(x, s7.s6[:5].aa[6]) // expected-error {{OpenMP array section is not allowed here}} |
| 192 |
#pragma omp target update to(x, s7.s6[:5].aa[:6]) // expected-error {{OpenMP array section is not allowed here}} |
| 193 |
#pragma omp target update to(s7.p[:10]) |
| 194 |
#pragma omp target update to(x, s7.bfa) // expected-error {{bit fields cannot be used to specify storage in a 'to' clause}} |
| 195 |
#pragma omp target update to(x, s7.p[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} |
| 196 |
#pragma omp target data map(to: s7.i) |
| 197 |
{ |
| 198 |
#pragma omp target update to(s7.x) |
| 199 |
} |
| 200 |
|
| 201 |
#pragma omp target update to(**(BB+*offset)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 202 |
#pragma omp target update to(**(BB+y)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 203 |
#pragma omp target update to(*(m+*offset)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 204 |
#pragma omp target update to(**(*offset+BB)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 205 |
#pragma omp target update to(**(y+BB)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 206 |
#pragma omp target update to(*(*offset+m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 207 |
#pragma omp target update to(**(*offset+BB+*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 208 |
#pragma omp target update to(**(*(*(&offset))+BB+*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 209 |
#pragma omp target update to(*(x+*(y+*(**BB+BBB)+s7.i))) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} |
| 210 |
#pragma omp target update to(*(m+(m))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}} |
| 211 |
#pragma omp target update to(*(1+y+y)) // expected-error {{indirection requires pointer operand ('int' invalid)}} |
| 212 |
{} |
| 213 |
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}} |
| 214 |
} |
| 215 |
|