aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++/target-has-device-addr-2.C
blob: d9a309d7af4e001e5618ebd09849efd07aa04e3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Testing 'has_device_addr' clause on the target construct with reference. */

#include <omp.h>

int
main ()
{
  int *dp = (int*)omp_target_alloc (sizeof(int), 0);

  #pragma omp target is_device_ptr(dp)
    *dp = 42;

  int &x = *dp;

  #pragma omp target has_device_addr(x)
    x = 24;

  #pragma omp target has_device_addr(x)
    if (x != 24)
      __builtin_abort ();

  omp_target_free(dp, 0);
}