aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/usm-1.c
blob: 1b35f19c45b19f256415424517de8aef6ba89343 (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 run } */

#include <omp.h>
#include <stdint.h>

int
main ()
{
  int *a = (int *) omp_alloc(sizeof(int), ompx_unified_shared_mem_alloc);
  if (!a)
    __builtin_abort ();

  *a = 42;
  uintptr_t a_p = (uintptr_t)a;

  #pragma omp target is_device_ptr(a)
    {
      if (*a != 42 || a_p != (uintptr_t)a)
	__builtin_abort ();
    }

  omp_free(a, ompx_unified_shared_mem_alloc);
  return 0;
}