1 // RUN: %libomptarget-compile-run-and-check-generic 2 3 #include <omp.h> 4 #include <stdio.h> 5 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." 10 main(void)11int main(void) { 12 int *A = (int *)omp_target_alloc(sizeof(int), omp_get_default_device()); 13 14 #pragma omp target 15 { *A = 1; } 16 17 int Result = 0; 18 #pragma omp target map(from : Result) 19 { Result = *A; } 20 21 // CHECK: PASS 22 if (Result == 1) 23 printf("PASS\n"); 24 25 omp_target_free(A, omp_get_default_device()); 26 } 27