aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/target-52.c
blob: 809380c6928d451221e11364345ec1c19a2ef20f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Only run this with available non-host devices; in that case, GCC sets
   the default-device-var to 0.  */

/* { dg-do run { target { offload_device } } } */
/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */
/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */

/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */

#include <omp.h>

int
main ()
{
  int x;
  #pragma omp target map(tofrom:x)
    x = 5 + omp_is_initial_device ();

  if (x != 5)
    __builtin_abort ();

  if (0 != omp_get_default_device())
    __builtin_abort ();
  return 0;
}