| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fopenmp" } */ |
| 3 |
|
| 4 |
extern int a, b; |
| 5 |
#define X 1 |
| 6 |
#define Y 0 |
| 7 |
|
| 8 |
#pragma omp begin declare target indirect |
| 9 |
void fn1 (void) { } |
| 10 |
#pragma omp end declare target |
| 11 |
|
| 12 |
#pragma omp begin declare target indirect (1) |
| 13 |
void fn2 (void) { } |
| 14 |
#pragma omp end declare target |
| 15 |
|
| 16 |
#pragma omp begin declare target indirect (0) |
| 17 |
void fn3 (void) { } |
| 18 |
#pragma omp end declare target |
| 19 |
|
| 20 |
void fn4 (void) { } |
| 21 |
#pragma omp declare target indirect to (fn4) |
| 22 |
|
| 23 |
void fn5 (void) { } |
| 24 |
#pragma omp declare target indirect (1) to (fn5) |
| 25 |
|
| 26 |
void fn6 (void) { } |
| 27 |
#pragma omp declare target indirect (0) to (fn6) |
| 28 |
|
| 29 |
void fn7 (void) { } |
| 30 |
#pragma omp declare target indirect (-1) to (fn7) |
| 31 |
|
| 32 |
/* Compile-time non-constant expressions are not allowed. */ |
| 33 |
void fn8 (void) { } |
| 34 |
#pragma omp declare target indirect (a + b) to (fn8) /* { dg-error "expected constant logical expression" } */ |
| 35 |
|
| 36 |
/* Compile-time constant expressions are permissible. */ |
| 37 |
void fn9 (void) { } |
| 38 |
#pragma omp declare target indirect (X*Y) to (fn9) |
| 39 |
|
| 40 |
/* 'omp declare target'...'omp end declare target' form cannot take clauses. */ |
| 41 |
#pragma omp declare target indirect /* { dg-error "directive with only 'device_type' or 'indirect' clauses" }*/ |
| 42 |
void fn10 (void) { } |
| 43 |
#pragma omp end declare target /* { dg-error "'#pragma omp end declare target' without corresponding '#pragma omp declare target' or '#pragma omp begin declare target'" } */ |
| 44 |
|
| 45 |
void fn11 (void) { } |
| 46 |
#pragma omp declare target indirect (1) indirect (0) to (fn11) /* { dg-error "too many .indirect. clauses" } */ |
| 47 |
|
| 48 |
void fn12 (void) { } |
| 49 |
#pragma omp declare target indirect ("abs") to (fn12) |
| 50 |
|
| 51 |
void fn13 (void) { } |
| 52 |
#pragma omp declare target indirect (5.5) enter (fn13) |
| 53 |
|
| 54 |
void fn14 (void) { } |
| 55 |
#pragma omp declare target indirect (1) device_type (host) enter (fn14) /* { dg-error "'device_type' clause must specify 'any' when used with an 'indirect' clause" } */ |
| 56 |
|
| 57 |
void fn15 (void) { } |
| 58 |
#pragma omp declare target indirect (0) device_type (nohost) enter (fn15) |
| 59 |
|
| 60 |
/* Indirect on a variable should have no effect. */ |
| 61 |
int x; |
| 62 |
#pragma omp declare target indirect to(x) |