(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
struct-elem-1.c
       1  #include <omp.h>
       2  #include <stdlib.h>
       3  
       4  struct S
       5  {
       6    int a, b;
       7  };
       8  typedef struct S S;
       9  
      10  int main (void)
      11  {
      12    int d = omp_get_default_device ();
      13    int id = omp_get_initial_device ();
      14  
      15    if (d < 0 || d >= omp_get_num_devices ())
      16      d = id;
      17  
      18    S s;
      19    #pragma omp target enter data map (alloc: s.a, s.b)
      20    #pragma omp target exit data map (release: s.b)
      21  
      22    /* OpenMP 5.0 structure element mapping rules describe that elements of same
      23       structure variable should allocate/deallocate in a uniform fashion, so
      24       "s.a" should be removed together by above 'exit data'.  */
      25    if (d != id && omp_target_is_present (&s.a, d))
      26      abort ();
      27  
      28    return 0;
      29  }