(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.oacc-c-c++-common/
lib-63.c
       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    fprintf (stderr, "CheCKpOInT\n");
      27    acc_memcpy_to_device (0, h, N);
      28  
      29    memset (&h[0], 0, N);
      30  
      31    acc_memcpy_from_device (h, d, 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 "" } */