| 1 | |
| 2 | // clang-format off |
| 3 | // RUN: %libomptarget-compilexx-generic |
| 4 | // RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,TRACE,NDEBG |
| 5 | // RUN: %not --crash %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK |
| 6 | // RUN: %libomptarget-compilexx-generic -g |
| 7 | // RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=1 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,TRACE,DEBUG |
| 8 | // RUN: %not --crash %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK |
| 9 | // clang-format on |
| 10 | |
| 11 | // UNSUPPORTED: nvptx64-nvidia-cuda |
| 12 | // UNSUPPORTED: nvptx64-nvidia-cuda-LTO |
| 13 | // UNSUPPORTED: aarch64-unknown-linux-gnu |
| 14 | // UNSUPPORTED: aarch64-unknown-linux-gnu-LTO |
| 15 | // UNSUPPORTED: x86_64-unknown-linux-gnu |
| 16 | // UNSUPPORTED: x86_64-unknown-linux-gnu-LTO |
| 17 | // UNSUPPORTED: s390x-ibm-linux-gnu |
| 18 | // UNSUPPORTED: s390x-ibm-linux-gnu-LTO |
| 19 | |
| 20 | struct S {}; |
| 21 | |
| 22 | template <typename T> void cxx_function_name(int I, T *) { |
| 23 | |
| 24 | #pragma omp target |
| 25 | { |
| 26 | } |
| 27 | #pragma omp target |
| 28 | { |
| 29 | } |
| 30 | #pragma omp target |
| 31 | { |
| 32 | __builtin_trap(); |
| 33 | } |
| 34 | #pragma omp target |
| 35 | { |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | int main(void) { |
| 40 | struct S s; |
| 41 | cxx_function_name(I: 1, &s); |
| 42 | } |
| 43 | |
| 44 | // clang-format off |
| 45 | // CHECK: OFFLOAD ERROR: Kernel 'omp target in void cxx_function_name<S>(int, S*) @ [[LINE:[0-9]+]] (__omp_offloading_{{.*}}__Z17cxx_function_nameI1SEviPT__l[[LINE]])' |
| 46 | // CHECK: OFFLOAD ERROR: execution interrupted by hardware trap instruction |
| 47 | // TRACE: launchKernel |
| 48 | // NDEBG: cxx_function_name<S>(int, S*) |
| 49 | // NDEBG: main |
| 50 | // DEBUG: cxx_function_name<S>(int, S*) {{.*}}kernel_trap.cpp: |
| 51 | // DEBUG: main {{.*}}kernel_trap.cpp: |
| 52 | // clang-format on |
| 53 | |