| 1 | // clang-format off |
| 2 | // RUN: %libomptarget-compileopt-generic |
| 3 | // RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,NDEBG |
| 4 | // RUN: %libomptarget-compileopt-generic -g |
| 5 | // RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_ALLOCATION_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,DEBUG |
| 6 | // clang-format on |
| 7 | |
| 8 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
| 9 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
| 10 | // UNSUPPORTED: x86_64-unknown-linux-gnu |
| 11 | // UNSUPPORTED: x86_64-unknown-linux-gnu-LTO |
| 12 | // UNSUPPORTED: s390x-ibm-linux-gnu |
| 13 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
| 14 | |
| 15 | #include <omp.h> |
| 16 | |
| 17 | void *llvm_omp_target_alloc_host(size_t Size, int DeviceNum); |
| 18 | |
| 19 | int main(void) { |
| 20 | void *P = llvm_omp_target_alloc_host(8, 0); |
| 21 | omp_target_free(P, 0); |
| 22 | } |
| 23 | |
| 24 | // clang-format off |
| 25 | // CHECK: OFFLOAD ERROR: deallocation requires device memory but allocation was pinned host memory: 0x |
| 26 | // CHECK: dataDelete |
| 27 | // CHECK: omp_target_free |
| 28 | // NDEBG: main |
| 29 | // DEBUG: main {{.*}}free_wrong_ptr_kind.c:22 |
| 30 | // |
| 31 | // CHECK: Last allocation of size 8 -> device pointer |
| 32 | // CHECK: dataAlloc |
| 33 | // CHECK: llvm_omp_target_alloc_host |
| 34 | // NDEBG: main |
| 35 | // DEBUG: main {{.*}}free_wrong_ptr_kind.c:21 |
| 36 | |