[mlir] fix memory effects in GPU barrier elimination (#117432)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-no_create-clause.c
blob56ca140e8b55b3df675de5fd5b9fe4811916d6ff
1 // RUN: %clang_cc1 %s -fopenacc -verify
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);
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);
28 #pragma acc parallel no_create(LocalComposite.ScalarMember, LocalComposite.ScalarMember)
29 while(1);
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);
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);
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);
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);
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);
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);