53 lines · cpp
1 2// clang-format off3// RUN: %libomptarget-compilexx-generic4// 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=CHECK6// RUN: %libomptarget-compilexx-generic -g7// 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,DEBUG8// RUN: %not --crash %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK9// clang-format on10 11// UNSUPPORTED: nvptx64-nvidia-cuda12// UNSUPPORTED: nvptx64-nvidia-cuda-LTO13// UNSUPPORTED: aarch64-unknown-linux-gnu14// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO15// UNSUPPORTED: x86_64-unknown-linux-gnu16// UNSUPPORTED: x86_64-unknown-linux-gnu-LTO17// UNSUPPORTED: s390x-ibm-linux-gnu18// UNSUPPORTED: s390x-ibm-linux-gnu-LTO19 20struct S {};21 22template <typename T> void cxx_function_name(int I, T *) {23 24#pragma omp target25 {26 }27#pragma omp target28 {29 }30#pragma omp target31 {32 __builtin_trap();33 }34#pragma omp target35 {36 }37}38 39int main(void) {40 struct S s;41 cxx_function_name(1, &s);42}43 44// clang-format off45// 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 instruction47// TRACE: launchKernel48// NDEBG: cxx_function_name<S>(int, S*)49// NDEBG: main50// DEBUG: cxx_function_name<S>(int, S*) {{.*}}kernel_trap.cpp:51// DEBUG: main {{.*}}kernel_trap.cpp:52// clang-format on53