1// clang-format off
2// RUN: %libomptarget-compile-generic
3// RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=24 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,NDEBG
4// RUN: %libomptarget-compile-generic -g
5// RUN: %not --crash env -u LLVM_DISABLE_SYMBOLIZATION OFFLOAD_TRACK_NUM_KERNEL_LAUNCH_TRACES=16 %libomptarget-run-generic 2>&1 | %fcheck-generic --check-prefixes=CHECK,DEBUG
6// clang-format on
7
8// UNSUPPORTED: nvptx64-nvidia-cuda
9// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
10// UNSUPPORTED: aarch64-unknown-linux-gnu
11// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
12// UNSUPPORTED: x86_64-unknown-linux-gnu
13// UNSUPPORTED: x86_64-unknown-linux-gnu-LTO
14// UNSUPPORTED: s390x-ibm-linux-gnu
15// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
16
17#include <omp.h>
18
19int main(void) {
20 int *A = 0;
21 for (int i = 0; i < 10; ++i) {
22#pragma omp target
23 {
24 }
25 }
26#pragma omp target
27 {
28 *A = 42;
29 }
30}
31// CHECK: Display 8 of the 8 last kernel launch traces
32// CHECK: Kernel 0: {{.*}} (__omp_offloading_{{.*}}_main_l26)
33// CHECK: launchKernel
34// NDEBG: main
35// DEBUG: main {{.*}}kernel_crash_many.c:26
36//
37// CHECK: Kernel 1: {{.*}} (__omp_offloading_{{.*}}_main_l22)
38// CHECK: launchKernel
39// NDEBG: main
40// DEBUG: main {{.*}}kernel_crash_many.c:
41//
42// CHECK: Kernel 2: {{.*}} (__omp_offloading_{{.*}}_main_l22)
43// CHECK: launchKernel
44// NDEBG: main
45// DEBUG: main {{.*}}kernel_crash_many.c:
46//
47// CHECK: Kernel 3: {{.*}} (__omp_offloading_{{.*}}_main_l22)
48// CHECK: launchKernel
49// NDEBG: main
50// DEBUG: main {{.*}}kernel_crash_many.c:
51//
52// CHECK: Kernel 4: {{.*}} (__omp_offloading_{{.*}}_main_l22)
53// CHECK: launchKernel
54// NDEBG: main
55// DEBUG: main {{.*}}kernel_crash_many.c:
56//
57// CHECK: Kernel 5: {{.*}} (__omp_offloading_{{.*}}_main_l22)
58// CHECK: launchKernel
59// NDEBG: main
60// DEBUG: main {{.*}}kernel_crash_many.c:
61//
62// CHECK: Kernel 6: {{.*}} (__omp_offloading_{{.*}}_main_l22)
63// CHECK: launchKernel
64// NDEBG: main
65// DEBUG: main {{.*}}kernel_crash_many.c:
66//
67// CHECK: Kernel 7: {{.*}} (__omp_offloading_{{.*}}_main_l22)
68// CHECK: launchKernel
69// NDEBG: main
70// DEBUG: main {{.*}}kernel_crash_many.c:
71//
72// CHECK-NOT: Kernel {{[[0-9]]+}}:
73

source code of offload/test/sanitizer/kernel_crash_many.c