aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/declare-target-indirect-1.c
blob: 0fcbb2d04e4d052553c1d2f40a730614485f6194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */

extern int a, b;
#define X 1
#define Y 0

#pragma omp begin declare target indirect
void fn1 (void) { }
#pragma omp end declare target

#pragma omp begin declare target indirect (1)
void fn2 (void) { }
#pragma omp end declare target

#pragma omp begin declare target indirect (0)
void fn3 (void) { }
#pragma omp end declare target

void fn4 (void) { }
#pragma omp declare target indirect to (fn4)

void fn5 (void) { }
#pragma omp declare target indirect (1) to (fn5)

void fn6 (void) { }
#pragma omp declare target indirect (0) to (fn6)

void fn7 (void) { }
#pragma omp declare target indirect (-1) to (fn7)

/* Compile-time non-constant expressions are not allowed.  */
void fn8 (void) { }
#pragma omp declare target indirect (a + b) to (fn8) /* { dg-error "expected constant logical expression" } */

/* Compile-time constant expressions are permissible.  */
void fn9 (void) { }
#pragma omp declare target indirect (X*Y) to (fn9)

/* 'omp declare target'...'omp end declare target' form cannot take clauses.  */
#pragma omp declare target indirect /* { dg-error "directive with only 'device_type' or 'indirect' clauses" }*/
void fn10 (void) { }
#pragma omp end declare target /* { dg-error "'#pragma omp end declare target' without corresponding '#pragma omp declare target' or '#pragma omp begin declare target'" } */

void fn11 (void) { }
#pragma omp declare target indirect (1) indirect (0) to (fn11) /* { dg-error "too many .indirect. clauses" } */

void fn12 (void) { }
#pragma omp  declare target indirect ("abs") to (fn12)

void fn13 (void) { }
#pragma omp declare target indirect (5.5) enter (fn13)

void fn14 (void) { }
#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" } */

void fn15 (void) { }
#pragma omp declare target indirect (0) device_type (nohost) enter (fn15)

/* Indirect on a variable should have no effect.  */
int x;
#pragma omp declare target indirect to(x)