[Openmp-commits] [openmp] [openmp] Segfaults/assertion errors on certain omp statements after calling `omp_pause_resource_all(omp_pause_hard)` (PR #154204)

Haiyang He via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 5 10:11:06 PDT 2025


================
@@ -8343,6 +8345,10 @@ void __kmp_cleanup(void) {
 
   __kmpc_destroy_allocator(KMP_GTID_SHUTDOWN, __kmp_def_allocator);
   __kmp_def_allocator = omp_default_mem_alloc;
+#ifdef KMP_TDATA_GTID
+  /*reset __kmp_gtid to initial value*/
+  __kmp_gtid = KMP_GTID_DNE;
+#endif
----------------
haiyanghee wrote:

Right I did realize clang inserts `__kmpc_global_thread_num()` at the beginning of functions. 

But how does not resetting `__kmp_gtid` to `KMP_GTID_DNE` for thread 0 imply that the runtime in serial initialized state after omp_pause_resource calls? It sounds like we want to call `__kmpc_global_thread_num()` (or something equivalent) right after omp_pause_resource to force serial initialized state?

https://github.com/llvm/llvm-project/pull/154204


More information about the Openmp-commits mailing list