[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-deviceptr-clause.c
blob44c4cc4e5ec279f97a083e558e67c06933a9df54
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 struct S {
4 int IntMem;
5 int *PtrMem;
6 };
8 void uses() {
9 int LocalInt;
10 int *LocalPtr;
11 int Array[5];
12 int *PtrArray[5];
13 struct S s;
15 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'int'}}
16 #pragma acc parallel deviceptr(LocalInt)
17 while (1);
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 parallel deviceptr(&LocalInt)
21 while (1);
23 #pragma acc serial deviceptr(LocalPtr)
24 while (1);
26 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'int[5]'}}
27 #pragma acc kernels deviceptr(Array)
28 while (1);
30 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'int'}}
31 #pragma acc parallel deviceptr(Array[0])
32 while (1);
34 // expected-error@+2{{OpenACC sub-array is not allowed here}}
35 // expected-note@+1{{expected variable of pointer type}}
36 #pragma acc parallel deviceptr(Array[0:1])
37 while (1);
39 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'int *[5]'}}
40 #pragma acc parallel deviceptr(PtrArray)
41 while (1);
43 #pragma acc parallel deviceptr(PtrArray[0])
44 while (1);
46 // expected-error@+2{{OpenACC sub-array is not allowed here}}
47 // expected-note@+1{{expected variable of pointer type}}
48 #pragma acc parallel deviceptr(PtrArray[0:1])
49 while (1);
51 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'struct S'}}
52 #pragma acc parallel deviceptr(s)
53 while (1);
55 // expected-error@+1{{expected pointer in 'deviceptr' clause, type is 'int'}}
56 #pragma acc parallel deviceptr(s.IntMem)
57 while (1);
59 #pragma acc parallel deviceptr(s.PtrMem)
60 while (1);
62 // expected-error@+1{{OpenACC 'deviceptr' clause is not valid on 'loop' directive}}
63 #pragma acc loop deviceptr(LocalInt)
64 for(;;);