Fortran: fix passing of NULL() actual argument to character dummy [PR104819]
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / declare-target-indirect-2.c
blob545f1a9fcbffa3c45bcaa5ed0da47b39114a94ef
1 /* { dg-do run } */
3 #define N 256
5 #pragma omp begin declare target indirect
6 int foo(void) { return 5; }
7 int bar(void) { return 8; }
8 int baz(void) { return 11; }
9 #pragma omp end declare target
11 int main (void)
13 int i, x = 0, expected = 0;
14 int (*fn_ptr[N])(void);
16 for (i = 0; i < N; i++)
18 switch (i % 3)
20 case 0: fn_ptr[i] = &foo; break;
21 case 1: fn_ptr[i] = &bar; break;
22 case 2: fn_ptr[i] = &baz; break;
24 expected += (*fn_ptr[i]) ();
27 #pragma omp target teams distribute parallel for \
28 reduction (+: x) map (to: fn_ptr) map (tofrom: x)
29 for (int i = 0; i < N; i++)
30 x += (*fn_ptr[i]) ();
32 return x - expected;