aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-1.c
blob: d8d7067e452a30eb9e98d57bbc894b3695897665 (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
#include <stdlib.h>
#include <assert.h>

struct dc
{
  int a;
  int *b;
};

int
main ()
{
  int n = 100, i;
  struct dc v = { .a = 3, .b = (int *) malloc (sizeof (int) * n) };

#pragma acc parallel loop copy(v.a, v.b[:n])
  for (i = 0; i < n; i++)
    v.b[i] = v.a;

  for (i = 0; i < 10; i++)
    assert (v.b[i] == v.a);

  return 0;
}