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