| 1 |
/* Verify that we refuse 'acc_map_data' when the "device address [...] is |
| 2 |
already mapped". */ |
| 3 |
|
| 4 |
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */ |
| 5 |
|
| 6 |
#include <assert.h> |
| 7 |
#include <stdio.h> |
| 8 |
#include <stdlib.h> |
| 9 |
#include <openacc.h> |
| 10 |
|
| 11 |
int |
| 12 |
main () |
| 13 |
{ |
| 14 |
const int N = 132; |
| 15 |
|
| 16 |
char *h1 = (char *) malloc (N); |
| 17 |
assert (h1); |
| 18 |
void *d = acc_create (h1, N); |
| 19 |
assert (d); |
| 20 |
|
| 21 |
char *h2 = (char *) malloc (N); |
| 22 |
assert (h2); |
| 23 |
/* Try to arrange a setting such that a later 'acc_unmap_data' would find the |
| 24 |
device memory object still referenced elsewhere. This is not possible, |
| 25 |
given the semantics of 'acc_map_data'. */ |
| 26 |
fprintf (stderr, "CheCKpOInT\n"); |
| 27 |
acc_map_data (h2, d, N); |
| 28 |
|
| 29 |
return 0; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ |
| 34 |
/* { dg-output "device address \\\[\[0-9a-fA-FxX\]+, \\\+132\\\] is already mapped" } */ |
| 35 |
/* { dg-shouldfail "" } */ |