brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · aeec001 Raw
36 lines · c
1// clang-format off2// RUN: %libomptarget-compileopt-generic3// RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,NDEBG4// RUN: %libomptarget-compileopt-generic -g5// RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,DEBUG6// clang-format on7 8// UNSUPPORTED: aarch64-unknown-linux-gnu9// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO10// UNSUPPORTED: x86_64-unknown-linux-gnu11// UNSUPPORTED: x86_64-unknown-linux-gnu-LTO12// UNSUPPORTED: s390x-ibm-linux-gnu13// UNSUPPORTED: s390x-ibm-linux-gnu-LTO14 15#include <omp.h>16 17void *llvm_omp_target_alloc_host(size_t Size, int DeviceNum);18 19int main(void) {20  void *P = llvm_omp_target_alloc_host(8, 0);21  omp_target_free(P, 0);22}23 24// clang-format off25// CHECK: OFFLOAD ERROR: deallocation requires device memory but allocation was pinned host memory: 0x26// CHECK:  dataDelete27// CHECK:  omp_target_free28// NDEBG: main29// DEBUG:  main {{.*}}free_wrong_ptr_kind.c:2230//31// CHECK: Last allocation of size 8 -> device pointer32// CHECK:  dataAlloc33// CHECK:  llvm_omp_target_alloc_host34// NDEBG:  main35// DEBUG:  main {{.*}}free_wrong_ptr_kind.c:2136