Current OMPT_STORE_RETURN_ADDRESS() is not allowed to overwrite the return
address of the thread, opening the possibility for the thread to keep
obsolete information when it encounters the next construct without consuming
the information. Return address should be overwritten to avoid this.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This will break many cases, where GOMP or even kmp functions call external kmpc functions rather than only internal kmp functions. In such case, the return address will point to the runtime function.
The idea of the macro is to ensure that only the first entry to the runtime will set the address.
Before we can make this change (and I would be more than happy about this change ;), we need to make sure, that no runtime code calls the external __kmpc interface (at least, if the external function tries to store the return address).
Examples for calls to __kmpc functions in the runtime code:
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_runtime.cpp#L1515
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_runtime.cpp#L1745
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_runtime.cpp#L2352
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_tasking.cpp#L2339
And many calls in the GOMP interface implementation:
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_gsupport.cpp
@protze.joachim, you are right.
I will come back to this with a test case and a correct fix.