summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/gomp/target-enter-data-1.c
blob: ce766d29e2dc245cffde13c5a771e14d6c365c0e (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
/* { dg-do compile } */
/* { dg-additional-options "-fopenmp -fdump-tree-gimple" } */

struct bar
{
  int num_vectors;
  double *vectors;
};

struct foo
{
  int num_vectors;
  struct bar *bars;
  double **vectors;
};

void func (struct foo *f, int n, int m)
{
  #pragma omp target enter data map (to: f->vectors[m][:n])
  #pragma omp target enter data map (to: f->bars[n].vectors[:m])
  #pragma omp target enter data map (to: f->bars[n].vectors[:f->bars[n].num_vectors])
}

/* { dg-final { scan-tree-dump-times "map\\(to:\\*_\[0-9\]+ \\\[len: _\[0-9\]+\\\]\\) map\\(attach:\[^-\]+->vectors \\\[bias: \[^\]\]+\\\]\\)" 3 "gimple" } } */