[Openmp-commits] [openmp] 66a3575 - [OpenMP] Fix releasing of stack memory

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 14 01:33:12 PDT 2020


Author: Joachim Protze
Date: 2020-08-14T10:32:53+02:00
New Revision: 66a3575c2895f3b06056908bb40699f16e4b92d7

URL: https://github.com/llvm/llvm-project/commit/66a3575c2895f3b06056908bb40699f16e4b92d7
DIFF: https://github.com/llvm/llvm-project/commit/66a3575c2895f3b06056908bb40699f16e4b92d7.diff

LOG: [OpenMP] Fix releasing of stack memory

Starting with 787eb0c637b I got spurious segmentation faults for some testcases. I could nail it down to `brel` trying to release the "memory" of the node allocated on the stack of __kmpc_omp_wait_deps. With this patch, you will see the assertion triggering for some of the tests in the test suite.

My proposed solution for the issue is to just patch __kmpc_omp_wait_deps:
```
  __kmp_init_node(&node);
-  node.dn.on_stack = 1;
+  // the stack owns the node
+  __kmp_node_ref(&node);
```

What do you think?

Reviewed By: AndreyChurbanov

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

Added: 
    

Modified: 
    openmp/runtime/src/kmp_taskdeps.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp
index 9a81196879a8..bf4865dd540e 100644
--- a/openmp/runtime/src/kmp_taskdeps.cpp
+++ b/openmp/runtime/src/kmp_taskdeps.cpp
@@ -771,6 +771,8 @@ void __kmpc_omp_wait_deps(ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps,
 
   kmp_depnode_t node = {0};
   __kmp_init_node(&node);
+  // the stack owns the node
+  __kmp_node_ref(&node);
 
   if (!__kmp_check_deps(gtid, &node, NULL, &current_task->td_dephash,
                         DEP_BARRIER, ndeps, dep_list, ndeps_noalias,


        


More information about the Openmp-commits mailing list