(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.oacc-c-c++-common/
structured-dynamic-lifetimes-6.c
       1  /* { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } } */
       2  
       3  #include <openacc.h>
       4  #include <assert.h>
       5  #include <stdlib.h>
       6  
       7  #define SIZE 1024
       8  
       9  int
      10  main (int argc, char *argv[])
      11  {
      12    char *block1 = (char *) malloc (SIZE);
      13    char *block2 = (char *) malloc (SIZE);
      14  
      15  #ifdef OPENACC_API
      16    acc_copyin (block1, SIZE);
      17    acc_copyin (block2, SIZE);
      18  #else
      19  #pragma acc enter data copyin(block1[0:SIZE], block2[0:SIZE])
      20  #endif
      21  
      22  #pragma acc data copy(block1[0:SIZE], block2[0:SIZE])
      23    {
      24  #ifdef OPENACC_API
      25      acc_copyout (block1, SIZE);
      26      acc_copyout (block2, SIZE);
      27  #else
      28  #pragma acc exit data copyout(block1[0:SIZE], block2[0:SIZE])
      29  #endif
      30      /* These should stay present until the end of the structured data
      31         lifetime.  */
      32      assert (acc_is_present (block1, SIZE));
      33      assert (acc_is_present (block2, SIZE));
      34    }
      35  
      36    assert (!acc_is_present (block1, SIZE));
      37    assert (!acc_is_present (block2, SIZE));
      38  
      39    free (block1);
      40    free (block2);
      41  
      42    return 0;
      43  }