| 1 |
// RUN: %clang_cc1 %s -fopenacc -verify |
| 2 |
|
| 3 |
struct S { |
| 4 |
int IntMem; |
| 5 |
int *PtrMem; |
| 6 |
}; |
| 7 |
|
| 8 |
void uses() { |
| 9 |
int LocalInt; |
| 10 |
int *LocalPtr; |
| 11 |
int Array[5]; |
| 12 |
int *PtrArray[5]; |
| 13 |
struct S s; |
| 14 |
|
| 15 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'int'}} |
| 16 |
#pragma acc exit data copyout(LocalInt) detach(LocalInt) |
| 17 |
; |
| 18 |
|
| 19 |
// expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} |
| 20 |
#pragma acc exit data copyout(LocalInt) detach(&LocalInt) |
| 21 |
; |
| 22 |
|
| 23 |
|
| 24 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'int[5]'}} |
| 25 |
#pragma acc exit data copyout(LocalInt) detach(Array) |
| 26 |
|
| 27 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'int'}} |
| 28 |
#pragma acc exit data copyout(LocalInt) detach(Array[0]) |
| 29 |
; |
| 30 |
|
| 31 |
// expected-error@+2{{OpenACC sub-array is not allowed here}} |
| 32 |
// expected-note@+1{{expected variable of pointer type}} |
| 33 |
#pragma acc exit data copyout(LocalInt) detach(Array[0:1]) |
| 34 |
; |
| 35 |
|
| 36 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'int *[5]'}} |
| 37 |
#pragma acc exit data copyout(LocalInt) detach(PtrArray) |
| 38 |
; |
| 39 |
|
| 40 |
#pragma acc exit data copyout(LocalInt) detach(PtrArray[0]) |
| 41 |
; |
| 42 |
|
| 43 |
// expected-error@+2{{OpenACC sub-array is not allowed here}} |
| 44 |
// expected-note@+1{{expected variable of pointer type}} |
| 45 |
#pragma acc exit data copyout(LocalInt) detach(PtrArray[0:1]) |
| 46 |
; |
| 47 |
|
| 48 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'struct S'}} |
| 49 |
#pragma acc exit data copyout(LocalInt) detach(s) |
| 50 |
; |
| 51 |
|
| 52 |
// expected-error@+1{{expected pointer in 'detach' clause, type is 'int'}} |
| 53 |
#pragma acc exit data copyout(LocalInt) detach(s.IntMem) |
| 54 |
; |
| 55 |
|
| 56 |
#pragma acc exit data copyout(LocalInt) detach(s.PtrMem) |
| 57 |
; |
| 58 |
|
| 59 |
// expected-error@+1{{OpenACC 'detach' clause is not valid on 'data' directive}} |
| 60 |
#pragma acc data copyin(LocalInt) detach(PtrArray[0]) |
| 61 |
; |
| 62 |
// expected-error@+1{{OpenACC 'detach' clause is not valid on 'enter data' directive}} |
| 63 |
#pragma acc enter data copyin(LocalInt) detach(PtrArray[0]) |
| 64 |
// expected-error@+1{{OpenACC 'detach' clause is not valid on 'host_data' directive}} |
| 65 |
#pragma acc host_data use_device(LocalInt) detach(PtrArray[0]) |
| 66 |
; |
| 67 |
} |