| 1 |
// RUN: %clang_cc1 %s -fopenacc -verify |
| 2 |
|
| 3 |
typedef struct IsComplete { |
| 4 |
struct S { int A; } CompositeMember; |
| 5 |
int ScalarMember; |
| 6 |
float ArrayMember[5]; |
| 7 |
void *PointerMember; |
| 8 |
} Complete; |
| 9 |
void uses(int IntParam, short *PointerParam, float ArrayParam[5], Complete CompositeParam) { |
| 10 |
int LocalInt; |
| 11 |
short *LocalPointer; |
| 12 |
float LocalArray[5]; |
| 13 |
Complete LocalComposite; |
| 14 |
// Check Appertainment: |
| 15 |
#pragma acc parallel no_create(LocalInt) |
| 16 |
while(1); |
| 17 |
#pragma acc serial no_create(LocalInt) |
| 18 |
while(1); |
| 19 |
#pragma acc kernels no_create(LocalInt) |
| 20 |
while(1); |
| 21 |
|
| 22 |
// Valid cases: |
| 23 |
#pragma acc parallel no_create(LocalInt, LocalPointer, LocalArray) |
| 24 |
while(1); |
| 25 |
#pragma acc parallel no_create(LocalArray[2:1]) |
| 26 |
while(1); |
| 27 |
|
| 28 |
#pragma acc parallel no_create(LocalComposite.ScalarMember, LocalComposite.ScalarMember) |
| 29 |
while(1); |
| 30 |
|
| 31 |
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} |
| 32 |
#pragma acc parallel no_create(1 + IntParam) |
| 33 |
while(1); |
| 34 |
|
| 35 |
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} |
| 36 |
#pragma acc parallel no_create(+IntParam) |
| 37 |
while(1); |
| 38 |
|
| 39 |
// expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}} |
| 40 |
#pragma acc parallel no_create(PointerParam[2:]) |
| 41 |
while(1); |
| 42 |
|
| 43 |
// expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}} |
| 44 |
#pragma acc parallel no_create(ArrayParam[2:5]) |
| 45 |
while(1); |
| 46 |
|
| 47 |
// expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}} |
| 48 |
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} |
| 49 |
#pragma acc parallel no_create((float*)ArrayParam[2:5]) |
| 50 |
while(1); |
| 51 |
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} |
| 52 |
#pragma acc parallel no_create((float)ArrayParam[2]) |
| 53 |
while(1); |
| 54 |
|
| 55 |
// expected-error@+1{{OpenACC 'no_create' clause is not valid on 'loop' directive}} |
| 56 |
#pragma acc loop no_create(LocalInt) |
| 57 |
for(int i = 5; i < 10;++i); |
| 58 |
} |