Files
clang-p2996/offload/test/api/omp_device_alloc.c
2024-08-14 13:56:12 -05:00

21 lines
433 B
C

// RUN: %libomptarget-compile-run-and-check-generic
#include <assert.h>
#include <omp.h>
#include <stdio.h>
int main() {
#pragma omp target teams num_teams(4)
#pragma omp parallel
{
int *ptr = (int *)omp_alloc(sizeof(int), omp_default_mem_alloc);
assert(ptr && "Ptr is (null)!");
*ptr = 1;
assert(*ptr == 1 && "Ptr is not 1");
omp_free(ptr, omp_default_mem_alloc);
}
// CHECK: PASS
printf("PASS\n");
}