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
13 int i
, x
= 0, expected
= 0;
14 int (*fn_ptr
[N
])(void);
16 for (i
= 0; i
< N
; i
++)
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
++)