29 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2 3#include <stdio.h>4 5// OpenMP 5.1, sec. 2.21.7.1 "map Clause", p. 351 L14-16:6// "If the map clause appears on a target, target data, or target exit data7// construct and a corresponding list item of the original list item is not8// present in the device data environment on exit from the region then the9// list item is ignored."10 11int main(void) {12 int f = 5, r = 6, d = 7, af = 8;13 14// Check exit from omp target data.15// CHECK: f = 5, af = 816#pragma omp target data map(from : f) map(always, from : af)17 {18#pragma omp target exit data map(delete : f, af)19 } printf("f = %d, af = %d\n", f, af);20 21// Check omp target exit data.22// CHECK: f = 5, r = 6, d = 7, af = 823#pragma omp target exit data map(from : f) map(release : r) map(delete : d) \24 map(always, from : af)25 printf("f = %d, r = %d, d = %d, af = %d\n", f, r, d, af);26 27 return 0;28}29