brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · acdaaa3 Raw
59 lines · c
1// RUN: %clang_cc1 %s -fopenacc -verify2 3typedef struct IsComplete {4  struct S { int A; } CompositeMember;5  int ScalarMember;6  float ArrayMember[5];7  void *PointerMember;8} Complete;9void 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 loop present(LocalInt)16  for(int i = 5; i < 10;++i);17#pragma acc serial loop present(LocalInt)18  for(int i = 5; i < 10;++i);19#pragma acc kernels loop present(LocalInt)20  for(int i = 5; i < 10;++i);21 22  // Valid cases:23#pragma acc parallel loop present(LocalInt, LocalPointer, LocalArray)24  for(int i = 5; i < 10;++i);25#pragma acc parallel loop present(LocalArray[2:1])26  for(int i = 5; i < 10;++i);27 28#pragma acc parallel loop present(LocalComposite.ScalarMember, LocalComposite.ScalarMember)29  for(int i = 5; i < 10;++i);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 loop present(1 + IntParam)33  for(int i = 5; i < 10;++i);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 loop present(+IntParam)37  for(int i = 5; i < 10;++i);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 loop present(PointerParam[2:])41  for(int i = 5; i < 10;++i);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 loop present(ArrayParam[2:5])45  for(int i = 5; i < 10;++i);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 loop present((float*)ArrayParam[2:5])50  for(int i = 5; i < 10;++i);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 loop present((float)ArrayParam[2])53  for(int i = 5; i < 10;++i);54 55  // expected-error@+1{{OpenACC 'present' clause is not valid on 'loop' directive}}56#pragma acc loop present(LocalInt)57  for(int i = 5; i < 10;++i);58}59