[Openmp-commits] [openmp] [OpenMP] Fix node destruction race in __kmpc_omp_taskwait_deps_51 (PR #86130)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 27 07:47:23 PDT 2024


================
@@ -1030,6 +1030,12 @@ void __kmpc_omp_taskwait_deps_51(ident_t *loc_ref, kmp_int32 gtid,
                        __kmp_task_stealing_constraint);
   }
 
+  // Wait until the last __kmp_release_deps is finished before we free the
+  // current stack frame holding the "node" variable; once its nrefs count
+  // reaches 1, we're sure nobody else can try to reference it again.
+  while (node.dn.nrefs > 1)
----------------
shiltian wrote:

I'm not sure this is the right way to do that, especially using task yield. @jprotze might have a better idea.

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


More information about the Openmp-commits mailing list