1 /* Exercise acc_update_device with size zero data on nvidia targets. */ 2 3 /* { dg-do run { target openacc_nvidia_accel_selected } } */ 4 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <openacc.h> 8 9 int main(int argc,char ** argv)10main (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_copyin (h, N); 25 if (!d) 26 abort (); 27 28 for (i = 0; i < N; i++) 29 { 30 h[i] = 0xab; 31 } 32 33 fprintf (stderr, "CheCKpOInT\n"); 34 acc_update_device (h, 0); 35 36 acc_copyout (h, N); 37 38 for (i = 0; i < N; i++) 39 { 40 if (h[i] != 0xab) 41 abort (); 42 } 43 44 free (h); 45 46 return 0; 47 } 48 49 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ 50 /* { dg-output "\\\[\[0-9a-fA-FxX\]+,0\\\] is not mapped" } */ 51 /* { dg-shouldfail "" } */ 52