(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.oacc-c-c++-common/
lib-45.c
       1  /* { dg-do run } */
       2  /* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
       3  
       4  #include <stdlib.h>
       5  #include <openacc.h>
       6  
       7  int
       8  main (int argc, char **argv)
       9  {
      10    const int N = 256;
      11    int i;
      12    unsigned char *h;
      13    void *d;
      14  
      15    h = (unsigned char *) malloc (N);
      16  
      17    for (i = 0; i < N; i++)
      18      {
      19        h[i] = i;
      20      }
      21  
      22    d = acc_copyin (h, N);
      23    if (!d)
      24      abort ();
      25  
      26    for (i = 0; i < N; i++)
      27      {
      28        h[i] = 0xab;
      29      }
      30  
      31    acc_update_device (h, N - 2);
      32  
      33    acc_copyout (h, N);
      34  
      35    for (i = 0; i < N - 2; i++)
      36      {
      37        if (h[i] != 0xab)
      38  	abort ();
      39      }
      40  
      41    for (i = N - 2; i < N; i++)
      42      {
      43        if (h[i] != i)
      44  	abort ();
      45      }
      46  
      47    free (h);
      48  
      49    return 0;
      50  }