| 1 |
/* Check OMP_TARGET_OFFLOAD on systems with no available non-host devices; |
| 2 |
here with using -foffload=disable. |
| 3 |
As default-device-var is set to 0 (= host in this case), it should not fail. */ |
| 4 |
|
| 5 |
/* Note that -foffload=disable will still find devices on the system and only |
| 6 |
when trying to use them, it will fail as no binary data has been produced. |
| 7 |
The "target offload_device" case is checked for in 'target-50a.c'. */ |
| 8 |
|
| 9 |
/* { dg-do run { target { ! offload_device } } } */ |
| 10 |
|
| 11 |
/* { dg-additional-options "-foffload=disable" } */ |
| 12 |
/* { dg-set-target-env-var OMP_TARGET_OFFLOAD "mandatory" } */ |
| 13 |
/* { dg-set-target-env-var OMP_DEFAULT_DEVICE "0" } */ |
| 14 |
/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */ |
| 15 |
|
| 16 |
/* { dg-output ".*OMP_DEFAULT_DEVICE = '0'.*OMP_TARGET_OFFLOAD = 'MANDATORY'.*" } */ |
| 17 |
|
| 18 |
int |
| 19 |
main () |
| 20 |
{ |
| 21 |
int x; |
| 22 |
#pragma omp target map(tofrom:x) |
| 23 |
x = 5; |
| 24 |
if (x != 5) |
| 25 |
__builtin_abort (); |
| 26 |
return 0; |
| 27 |
} |