Bump version to 19.1.0-rc3
[llvm-project.git] / offload / test / mapping / implicit_device_ptr.c
blobbaa75d21686a75518b32056d9e6328d5269ef72a
1 // RUN: %libomptarget-compile-run-and-check-generic
3 #include <omp.h>
4 #include <stdio.h>
6 // OpenMP 5.1. sec 5.8.6 "Pointer Initialization for Device Data Environments"
7 // p. 160 L32-33: "If a matching mapped list item is not found, the pointer
8 // retains its original value as per the32 firstprivate semantics described in
9 // Section 5.4.4."
11 int main(void) {
12 int *A = (int *)omp_target_alloc(sizeof(int), omp_get_default_device());
14 #pragma omp target
15 { *A = 1; }
17 int Result = 0;
18 #pragma omp target map(from : Result)
19 { Result = *A; }
21 // CHECK: PASS
22 if (Result == 1)
23 printf("PASS\n");
25 omp_target_free(A, omp_get_default_device());