[llvm-branch-commits] [openmp] r318176 - Merging r316452:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 14 11:19:10 PST 2017


Author: tstellar
Date: Tue Nov 14 11:19:10 2017
New Revision: 318176

URL: http://llvm.org/viewvc/llvm-project?rev=318176&view=rev
Log:
Merging r316452:

------------------------------------------------------------------------
r316452 | jlpeyton | 2017-10-24 09:10:09 -0700 (Tue, 24 Oct 2017) | 9 lines

Disable threadprivate data cleanup if runtime is terminating

The problem is due to the runtime's threadprivate cleanup code which tries to
access data that was already destroyed by one of the root threads.
__kmp_init_gtid is used as a checker here since it is set to false before actual
resource cleanup is done in __kmp_cleanup().

Patch by Hansang Bae

------------------------------------------------------------------------

Modified:
    openmp/branches/release_50/runtime/src/kmp_threadprivate.cpp

Modified: openmp/branches/release_50/runtime/src/kmp_threadprivate.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/branches/release_50/runtime/src/kmp_threadprivate.cpp?rev=318176&r1=318175&r2=318176&view=diff
==============================================================================
--- openmp/branches/release_50/runtime/src/kmp_threadprivate.cpp (original)
+++ openmp/branches/release_50/runtime/src/kmp_threadprivate.cpp Tue Nov 14 11:19:10 2017
@@ -228,6 +228,13 @@ void __kmp_common_destroy_gtid(int gtid)
   struct private_common *tn;
   struct shared_common *d_tn;
 
+  if (!TCR_4(__kmp_init_gtid)) {
+    // This is possible when one of multiple roots initiates early library
+    // termination in a sequential region while other teams are active, and its
+    // child threads are about to end.
+    return;
+  }
+
   KC_TRACE(10, ("__kmp_common_destroy_gtid: T#%d called\n", gtid));
   if ((__kmp_foreign_tp) ? (!KMP_INITIAL_GTID(gtid)) : (!KMP_UBER_GTID(gtid))) {
 




More information about the llvm-branch-commits mailing list