Debian Codegraph @

libgomp/testsuite/libgomp.c-c++-common/declare-target-indirect-1.c

raw
1 /* { dg-do run } */
2
3 #pragma omp begin declare target indirect
4 int foo(void) { return 5; }
5 int bar(void) { return 8; }
6 int baz(void) { return 11; }
7 #pragma omp end declare target
8
9 int main (void)
10 {
11 int x;
12 int (*foo_ptr) (void) = &foo;
13 int (*bar_ptr) (void) = &bar;
14 int (*baz_ptr) (void) = &baz;
15 int expected = foo () + bar () + baz ();
16
17 #pragma omp target map (to: foo_ptr, bar_ptr, baz_ptr) map (from: x)
18 x = (*foo_ptr) () + (*bar_ptr) () + (*baz_ptr) ();
19
20 return x - expected;
21 }