diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-18 19:40:24 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-18 19:40:24 +0000 |
| commit | 0c99d19470bab02158856ac88dc1cc0fb40a4570 (patch) | |
| tree | 8a0549773668260d42a8520de108e6eed7e1c337 /clang/lib/Sema | |
| parent | 892758a52651f335ae4cd5f79bcb4f2c2e119e81 (diff) | |
| download | bcm5719-llvm-0c99d19470bab02158856ac88dc1cc0fb40a4570.tar.gz bcm5719-llvm-0c99d19470bab02158856ac88dc1cc0fb40a4570.zip | |
[OPENMP]Fix sharing of threadprivate variables with TLS support.
If the threadprivate variable is used in the copyin clause on inner
parallel directive with TLS support, we capture this variable in all
outer OpenMP scopes. It leads to the fact that in all scopes we're
working with the original variable, not the threadprivate copies.
llvm-svn: 366483
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index bec2fd8d3c0..4ac87469bf4 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1882,6 +1882,13 @@ bool Sema::isOpenMPPrivateDecl(const ValueDecl *D, unsigned Level) const { !isOpenMPSimdDirective(DSAStack->getCurrentDirective())) return true; } + if (const auto *VD = dyn_cast<VarDecl>(D)) { + if (DSAStack->isThreadPrivate(const_cast<VarDecl *>(VD)) && + DSAStack->isForceVarCapturing() && + !DSAStack->hasExplicitDSA( + D, [](OpenMPClauseKind K) { return K == OMPC_copyin; }, Level)) + return true; + } return DSAStack->hasExplicitDSA( D, [](OpenMPClauseKind K) { return K == OMPC_private; }, Level) || (DSAStack->isClauseParsingMode() && |

