| 1 |
/* Verify OMP instances of variables with address space. */ |
| 2 |
|
| 3 |
/* { dg-do run { target i?86-*-* x86_64-*-* } } */ |
| 4 |
/* { dg-require-effective-target offload_device_nonshared_as } */ |
| 5 |
|
| 6 |
#include <assert.h> |
| 7 |
|
| 8 |
int __seg_fs a; |
| 9 |
|
| 10 |
int |
| 11 |
main (void) |
| 12 |
{ |
| 13 |
// a = 123; // SIGSEGV |
| 14 |
int b; |
| 15 |
#pragma omp target map(alloc: a) map(from: b) |
| 16 |
{ |
| 17 |
a = 321; // no SIGSEGV (given 'offload_device_nonshared_as') |
| 18 |
asm volatile ("" : : "g" (&a) : "memory"); |
| 19 |
b = a; |
| 20 |
} |
| 21 |
assert (b == 321); |
| 22 |
|
| 23 |
return 0; |
| 24 |
} |