[OpenMP] Fixes for shared memory cleanup when aborts occur
authorAndreyChurbanov <andrey.churbanov@intel.com>
Tue, 10 Nov 2020 21:16:23 +0000 (00:16 +0300)
committerAndreyChurbanov <andrey.churbanov@intel.com>
Tue, 10 Nov 2020 21:16:23 +0000 (00:16 +0300)
Patch by Erdner, Todd <todd.erdner@intel.com>

Differential Revision: https://reviews.llvm.org/D90974

openmp/runtime/src/kmp_runtime.cpp

index 71a55e8..6ff11db 100644 (file)
@@ -441,6 +441,7 @@ void __kmp_abort_process() {
     raise(SIGABRT);
     _exit(3); // Just in case, if signal ignored, exit anyway.
   } else {
+    __kmp_unregister_library();
     abort();
   }
 
@@ -6170,6 +6171,7 @@ void __kmp_internal_end_library(int gtid_req) {
       if (__kmp_root[gtid]->r.r_active) {
         __kmp_global.g.g_abort = -1;
         TCW_SYNC_4(__kmp_global.g.g_done, TRUE);
+        __kmp_unregister_library();
         KA_TRACE(10,
                  ("__kmp_internal_end_library: root still active, abort T#%d\n",
                   gtid));