148c8a579Serichkeane // RUN: %clang_cc1 %s -fopenacc -verify 248c8a579Serichkeane 348c8a579Serichkeane struct S { 448c8a579Serichkeane int IntMem; 548c8a579Serichkeane int *PtrMem; 648c8a579Serichkeane }; 748c8a579Serichkeane 848c8a579Serichkeane void uses() { 948c8a579Serichkeane int LocalInt; 1048c8a579Serichkeane int *LocalPtr; 1148c8a579Serichkeane int Array[5]; 1248c8a579Serichkeane int *PtrArray[5]; 1348c8a579Serichkeane struct S s; 1448c8a579Serichkeane 1548c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}} 1648c8a579Serichkeane #pragma acc parallel attach(LocalInt) 1748c8a579Serichkeane while (1); 1848c8a579Serichkeane 19a15b685cSErich 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}} 2048c8a579Serichkeane #pragma acc parallel attach(&LocalInt) 2148c8a579Serichkeane while (1); 2248c8a579Serichkeane 2348c8a579Serichkeane #pragma acc serial attach(LocalPtr) 2448c8a579Serichkeane while (1); 2548c8a579Serichkeane 2648c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'int[5]'}} 2748c8a579Serichkeane #pragma acc kernels attach(Array) 2848c8a579Serichkeane while (1); 2948c8a579Serichkeane 3048c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}} 3148c8a579Serichkeane #pragma acc parallel attach(Array[0]) 3248c8a579Serichkeane while (1); 3348c8a579Serichkeane 3448c8a579Serichkeane // expected-error@+2{{OpenACC sub-array is not allowed here}} 3548c8a579Serichkeane // expected-note@+1{{expected variable of pointer type}} 3648c8a579Serichkeane #pragma acc parallel attach(Array[0:1]) 3748c8a579Serichkeane while (1); 3848c8a579Serichkeane 3948c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'int *[5]'}} 4048c8a579Serichkeane #pragma acc parallel attach(PtrArray) 4148c8a579Serichkeane while (1); 4248c8a579Serichkeane 4348c8a579Serichkeane #pragma acc parallel attach(PtrArray[0]) 4448c8a579Serichkeane while (1); 4548c8a579Serichkeane 4648c8a579Serichkeane // expected-error@+2{{OpenACC sub-array is not allowed here}} 4748c8a579Serichkeane // expected-note@+1{{expected variable of pointer type}} 4848c8a579Serichkeane #pragma acc parallel attach(PtrArray[0:1]) 4948c8a579Serichkeane while (1); 5048c8a579Serichkeane 5148c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'struct S'}} 5248c8a579Serichkeane #pragma acc parallel attach(s) 5348c8a579Serichkeane while (1); 5448c8a579Serichkeane 5548c8a579Serichkeane // expected-error@+1{{expected pointer in 'attach' clause, type is 'int'}} 5648c8a579Serichkeane #pragma acc parallel attach(s.IntMem) 5748c8a579Serichkeane while (1); 5848c8a579Serichkeane 5948c8a579Serichkeane #pragma acc parallel attach(s.PtrMem) 6048c8a579Serichkeane while (1); 616119340eSerichkeane 6242f4e505SErich Keane // expected-error@+1{{OpenACC 'attach' clause is not valid on 'loop' directive}} 636119340eSerichkeane #pragma acc loop attach(LocalInt) 64*b0cfbfd7SErich Keane for(int i = 5; i < 10;++i); 6548c8a579Serichkeane } 66