fortran: Factor the evaluation of MINLOC/MAXLOC's BACK argument
[official-gcc.git] / libgomp / testsuite / libgomp.c / target-41.c
bloba300de4d009ebd3323e6f9709a1bc3a927333f7a
1 /* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */
3 #include <omp.h>
4 #include <stdlib.h>
6 int v;
8 void
9 foo (void)
11 v++;
14 #pragma omp declare target enter (v, foo)
16 int
17 main ()
19 /* OMP_TARGET_OFFLOAD=mandatory shouldn't fail for host fallback
20 if it is because the program explicitly asked for the host
21 fallback through if(false) or omp_get_initial_device () or
22 omp_initial_device as the device. */
23 #pragma omp target if (v)
24 foo ();
25 #pragma omp target device (omp_initial_device)
26 foo ();
27 #pragma omp target device (omp_get_initial_device ())
28 foo ();
29 omp_set_default_device (omp_get_initial_device ());
30 #pragma omp target
31 foo ();
32 if (v != 4)
33 abort ();
34 return 0;