[Openmp-commits] [openmp] [libomp] Fix hang when a fatal error is raised before library registration (PR #215988)

Michael Klemm via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 14 08:50:05 PDT 2026


================
@@ -6918,6 +6927,13 @@ void __kmp_register_library_startup(void) {
 
 void __kmp_unregister_library(void) {
 
+  // The library can be torn down before it ever registered itself, e.g. when
+  // __kmp_abort_process() runs for a fatal error raised during environment
+  // parsing. There is nothing to unregister then, and __kmp_registration_str
+  // is still NULL, so the strcmp() below would dereference it.
+  if (__kmp_registration_flag == 0)
+    return;
----------------
mjklemm wrote:

This might be a race condition, but I think fixing the race conditiion is beyond the scope of this PR.

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


More information about the Openmp-commits mailing list