Debian Codegraph @

libgomp/testsuite/libgomp.c/target-52.c

raw
1 /* Only run this with available non-host devices; in that case, GCC sets
2 the default-device-var to 0. */
3
4 /* { dg-do run { target { offload_device } } } */
5 /* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */
6 /* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */
7
8 /* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */
9
10 #include <omp.h>
11
12 int
13 main ()
14 {
15 int x;
16 #pragma omp target map(tofrom:x)
17 x = 5 + omp_is_initial_device ();
18
19 if (x != 5)
20 __builtin_abort ();
21
22 if (0 != omp_get_default_device())
23 __builtin_abort ();
24 return 0;
25 }