aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-5.c
blob: a3737a7dae0d56853e75bcf1ee1928f2f7a2550e (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
/* { dg-do run { target openacc_nvidia_accel_selected } } */

#include <openacc.h>
#include <stdlib.h>

#define N 1024

int main (int argc, char* argv[])
{
  int x[N], y[N], *yp;

  yp = y + 1;

#pragma acc data copyin (x[0:N])
  {
    int *xp, *yp2;
#pragma acc host_data use_device (x)
    {
#pragma acc data copyin (y)
      {
#pragma acc host_data use_device (yp)
	{
	  xp = x;
	  yp2 = yp;
	}

        if (yp2 != acc_deviceptr (yp))
	  abort ();
      }
    }

    if (xp != acc_deviceptr (x))
      abort ();

  }

  return 0;
}