| 1 |
// RUN: %clang_cc1 %s -fopenacc -verify |
| 2 |
|
| 3 |
void BoolExpr(int *I, float *F) { |
| 4 |
|
| 5 |
typedef struct {} SomeStruct; |
| 6 |
int Array[5]; |
| 7 |
|
| 8 |
struct C{}; |
| 9 |
// expected-error@+1{{expected expression}} |
| 10 |
#pragma acc parallel if (struct C f()) |
| 11 |
while(0); |
| 12 |
|
| 13 |
// expected-error@+1{{unexpected type name 'SomeStruct': expected expression}} |
| 14 |
#pragma acc serial if (SomeStruct) |
| 15 |
while(0); |
| 16 |
|
| 17 |
// expected-error@+1{{unexpected type name 'SomeStruct': expected expression}} |
| 18 |
#pragma acc serial if (SomeStruct()) |
| 19 |
while(0); |
| 20 |
|
| 21 |
SomeStruct S; |
| 22 |
// expected-error@+1{{statement requires expression of scalar type ('SomeStruct' invalid)}} |
| 23 |
#pragma acc serial if (S) |
| 24 |
while(0); |
| 25 |
|
| 26 |
// expected-warning@+1{{address of array 'Array' will always evaluate to 'true'}} |
| 27 |
#pragma acc kernels if (Array) |
| 28 |
while(0); |
| 29 |
|
| 30 |
// expected-error@+4{{incompatible pointer types assigning to 'int *' from 'float *'}} |
| 31 |
// expected-warning@+3{{using the result of an assignment as a condition without parentheses}} |
| 32 |
// expected-note@+2{{place parentheses around the assignment to silence this warning}} |
| 33 |
// expected-note@+1{{use '==' to turn this assignment into an equality comparison}} |
| 34 |
#pragma acc kernels if (I = F) |
| 35 |
while(0); |
| 36 |
|
| 37 |
#pragma acc parallel if (I) |
| 38 |
while(0); |
| 39 |
|
| 40 |
#pragma acc serial if (F) |
| 41 |
while(0); |
| 42 |
|
| 43 |
#pragma acc kernels if (*I < *F) |
| 44 |
while(0); |
| 45 |
|
| 46 |
// expected-error@+1{{OpenACC 'data' construct must have at least one 'attach', 'copy', 'copyin', 'copyout', 'create', 'default', 'deviceptr', 'no_create', or 'present' clause}} |
| 47 |
#pragma acc data if (*I < *F) |
| 48 |
while(0); |
| 49 |
#pragma acc parallel loop if (*I < *F) |
| 50 |
for(int i = 0; i < 5; ++i); |
| 51 |
#pragma acc serial loop if (*I < *F) |
| 52 |
for(int i = 0; i < 5; ++i); |
| 53 |
#pragma acc kernels loop if (*I < *F) |
| 54 |
for(int i = 0; i < 5; ++i); |
| 55 |
|
| 56 |
// expected-error@+1{{OpenACC 'if' clause is not valid on 'loop' directive}} |
| 57 |
#pragma acc loop if(I) |
| 58 |
for(int i = 5; i < 10;++i); |
| 59 |
} |