[OpenMP] Fix releasing of stack memory
authorJoachim Protze <protze@itc.rwth-aachen.de>
Fri, 14 Aug 2020 08:13:31 +0000 (10:13 +0200)
committerJoachim Protze <protze@itc.rwth-aachen.de>
Fri, 14 Aug 2020 08:32:53 +0000 (10:32 +0200)
commit66a3575c2895f3b06056908bb40699f16e4b92d7
tree4b34eba91a017107d3bcd8ac7d8c67d894841744
parent1786908f8cefe4c5f114543d73a8de23c130e94e
[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
openmp/runtime/src/kmp_taskdeps.cpp