101e91a2dSerichkeane 201e91a2dSerichkeane // RUN: %clang_cc1 %s -fopenacc -verify 301e91a2dSerichkeane 401e91a2dSerichkeane typedef struct IsComplete { 501e91a2dSerichkeane struct S { int A; } CompositeMember; 601e91a2dSerichkeane int ScalarMember; 701e91a2dSerichkeane float ArrayMember[5]; 801e91a2dSerichkeane void *PointerMember; 901e91a2dSerichkeane } Complete; 1001e91a2dSerichkeane void uses(int IntParam, short *PointerParam, float ArrayParam[5], Complete CompositeParam) { 1101e91a2dSerichkeane int LocalInt; 1201e91a2dSerichkeane short *LocalPointer; 1301e91a2dSerichkeane float LocalArray[5]; 1401e91a2dSerichkeane Complete LocalComposite; 1501e91a2dSerichkeane // Check Appertainment: 1601e91a2dSerichkeane #pragma acc parallel create(LocalInt) 1701e91a2dSerichkeane while(1); 1801e91a2dSerichkeane #pragma acc serial create(LocalInt) 1901e91a2dSerichkeane while(1); 2001e91a2dSerichkeane #pragma acc kernels create(LocalInt) 2101e91a2dSerichkeane while(1); 2201e91a2dSerichkeane 2301e91a2dSerichkeane // expected-warning@+1{{OpenACC clause name 'pcreate' is a deprecated clause name and is now an alias for 'create'}} 2401e91a2dSerichkeane #pragma acc parallel pcreate(LocalInt) 2501e91a2dSerichkeane while(1); 2601e91a2dSerichkeane 2701e91a2dSerichkeane // expected-warning@+1{{OpenACC clause name 'present_or_create' is a deprecated clause name and is now an alias for 'create'}} 2801e91a2dSerichkeane #pragma acc parallel present_or_create(LocalInt) 2901e91a2dSerichkeane while(1); 3001e91a2dSerichkeane 3101e91a2dSerichkeane // Valid cases: 3201e91a2dSerichkeane #pragma acc parallel create(LocalInt, LocalPointer, LocalArray) 3301e91a2dSerichkeane while(1); 3401e91a2dSerichkeane #pragma acc parallel create(LocalArray[2:1]) 3501e91a2dSerichkeane while(1); 3601e91a2dSerichkeane #pragma acc parallel create(zero:LocalArray[2:1]) 3701e91a2dSerichkeane while(1); 3801e91a2dSerichkeane 3901e91a2dSerichkeane #pragma acc parallel create(LocalComposite.ScalarMember, LocalComposite.ScalarMember) 4001e91a2dSerichkeane while(1); 4101e91a2dSerichkeane 42a15b685cSErich Keane // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} 4301e91a2dSerichkeane #pragma acc parallel create(1 + IntParam) 4401e91a2dSerichkeane while(1); 4501e91a2dSerichkeane 46a15b685cSErich Keane // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} 4701e91a2dSerichkeane #pragma acc parallel create(+IntParam) 4801e91a2dSerichkeane while(1); 4901e91a2dSerichkeane 5001e91a2dSerichkeane // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}} 5101e91a2dSerichkeane #pragma acc parallel create(PointerParam[2:]) 5201e91a2dSerichkeane while(1); 5301e91a2dSerichkeane 5401e91a2dSerichkeane // expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}} 5501e91a2dSerichkeane #pragma acc parallel create(ArrayParam[2:5]) 5601e91a2dSerichkeane while(1); 5701e91a2dSerichkeane 5801e91a2dSerichkeane // expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}} 59a15b685cSErich Keane // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} 6001e91a2dSerichkeane #pragma acc parallel create((float*)ArrayParam[2:5]) 6101e91a2dSerichkeane while(1); 62a15b685cSErich Keane // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} 6301e91a2dSerichkeane #pragma acc parallel create((float)ArrayParam[2]) 6401e91a2dSerichkeane while(1); 6501e91a2dSerichkeane // expected-error@+2{{invalid tag 'invalid' on 'create' clause}} 66a15b685cSErich Keane // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}} 6701e91a2dSerichkeane #pragma acc parallel create(invalid:(float)ArrayParam[2]) 6801e91a2dSerichkeane while(1); 696119340eSerichkeane 7042f4e505SErich Keane // expected-error@+1{{OpenACC 'create' clause is not valid on 'loop' directive}} 716119340eSerichkeane #pragma acc loop create(LocalInt) 72*b0cfbfd7SErich Keane for(int i = 5; i < 10;++i); 7342f4e505SErich Keane // expected-error@+1{{OpenACC 'pcreate' clause is not valid on 'loop' directive}} 746119340eSerichkeane #pragma acc loop pcreate(LocalInt) 75*b0cfbfd7SErich Keane for(int i = 5; i < 10;++i); 7642f4e505SErich Keane // expected-error@+1{{OpenACC 'present_or_create' clause is not valid on 'loop' directive}} 776119340eSerichkeane #pragma acc loop present_or_create(LocalInt) 78*b0cfbfd7SErich Keane for(int i = 5; i < 10;++i); 7901e91a2dSerichkeane } 80