aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/target-50.c
blob: 6f15569ee211caaaf095d52ac9447440c1b346c1 (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
26
27
/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices;
   here with using -foffload=disable.
   As default-device-var is set to 0 (= host in this case), it should not fail.  */

/* Note that -foffload=disable will still find devices on the system and only
   when trying to use them, it will fail as no binary data has been produced.
   The "target offload_device" case is checked for in 'target-50a.c'.  */

/* { dg-do run { target { ! offload_device } } } */

/* { dg-additional-options "-foffload=disable" } */
/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */
/* { dg-set-target-env-var OMP_DEFAULT_DEVICE "0" } */
/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */

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

int
main ()
{
  int x;
  #pragma omp target map(tofrom:x)
    x = 5;
  if (x != 5)
    __builtin_abort ();
  return 0;
}