Debian Codegraph @

openmp/runtime/test/ompt/misc/lock_double_destroy.cpp

raw
1 // clang-format off
2 // RUN: %libomp-cxx-compile-and-run | FileCheck %s
3
4 // disabled until fixed, see: https://github.com/llvm/llvm-project/pull/145625#issuecomment-3007625680
5 // remove "needs-fix", after fixing the issue in the runtime
6 // REQUIRES: ompt, needs-fix
7 // clang-format on
8 #include "callback.h"
9 #include "omp_testsuite.h"
10
11 // tests that the destructor doesn't segv even though
12 // ompt_finalize_tool() destroys the lock
13 struct myLock {
14 omp_lock_t lock;
15 myLock() { omp_init_lock(&lock); }
16 ~myLock() { omp_destroy_lock(&lock); }
17 };
18
19 myLock lock;
20
21 int main() {
22 go_parallel_nthreads(2);
23
24 printf("Before ompt_finalize_tool\n");
25 ompt_finalize_tool();
26 printf("After ompt_finalize_tool\n");
27
28 return get_exit_value();
29 }
30
31 // clang-format off
32 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
33 // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_thread_begin:
34 // CHECK-SAME: thread_type=ompt_thread_initial=1
35
36 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_init_lock
37
38 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_begin
39 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_parallel_end
40
41 // CHECK: {{^}}Before ompt_finalize_tool
42
43 // CHECK: {{^}}[[THREAD_ID]]: ompt_event_thread_end: thread_id=[[THREAD_ID]]
44 // CHECK: 0: ompt_event_runtime_shutdown
45
46 // CHECK: {{^}}After ompt_finalize_tool
47 // clang-format on