aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/struct-copyout-1.c
blob: 501a0e12732dc1b5765633e127cedd006e00e350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <assert.h>

struct str1 {
  int a;
  int b;
};

struct str2 {
  int c;
  int d;
  struct str1 s;
};

int
main (int argc, char *argv[])
{
  struct str2 t;

  t.c = 1;
  t.d = 2;
  t.s.a = 3;
  t.s.b = 4;

  #pragma acc enter data copyin(t.s)

  #pragma acc serial present(t.s) /* { dg-warning "using .vector_length \\(32\\)., ignoring 1" "" { target openacc_nvidia_accel_selected } } */
  {
    t.s.a = 5;
    t.s.b = 6;
  }

  #pragma acc exit data copyout(t.s)

  assert (t.s.a == 5);
  assert (t.s.b == 6);

  return 0;
}