[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / openmp / libomptarget / test / libc / malloc.c
blobc18a724930f41e5fa8eb81b35d2b2eaef43d4502
1 // RUN: %libomptarget-compile-run-and-check-generic
3 // REQUIRES: libc
5 #include <stdio.h>
6 #include <stdlib.h>
8 #pragma omp declare target to(malloc)
9 #pragma omp declare target to(free)
11 int main() {
12 unsigned h_x;
13 unsigned *d_x;
14 #pragma omp target map(from : d_x)
16 d_x = malloc(sizeof(unsigned));
17 *d_x = 1;
20 #pragma omp target is_device_ptr(d_x) map(from : h_x)
21 { h_x = *d_x; }
23 #pragma omp target is_device_ptr(d_x)
24 { free(d_x); }
26 // CHECK: PASS
27 if (h_x == 1)
28 fputs("PASS\n", stdout);