| 1 |
/* Not all implement this checking. |
| 2 |
{ dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <string.h> |
| 6 |
#include <stdlib.h> |
| 7 |
#include <openacc.h> |
| 8 |
|
| 9 |
int |
| 10 |
main (int argc, char **argv) |
| 11 |
{ |
| 12 |
const int N = 256; |
| 13 |
int i; |
| 14 |
unsigned char *h; |
| 15 |
void *d; |
| 16 |
|
| 17 |
h = (unsigned char *) malloc (N); |
| 18 |
|
| 19 |
for (i = 0; i < N; i++) |
| 20 |
{ |
| 21 |
h[i] = i; |
| 22 |
} |
| 23 |
|
| 24 |
d = acc_malloc (N); |
| 25 |
|
| 26 |
acc_memcpy_to_device (d, h, N); |
| 27 |
|
| 28 |
memset (&h[0], 0, N); |
| 29 |
|
| 30 |
fprintf (stderr, "CheCKpOInT\n"); |
| 31 |
acc_memcpy_from_device (h, 0, N); |
| 32 |
|
| 33 |
for (i = 0; i < N; i++) |
| 34 |
{ |
| 35 |
if (h[i] != i) |
| 36 |
abort (); |
| 37 |
} |
| 38 |
|
| 39 |
acc_free (d); |
| 40 |
|
| 41 |
free (h); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ |
| 47 |
/* { dg-output "invalid device address" } */ |
| 48 |
/* { dg-shouldfail "" } */ |