diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-06-21 15:08:30 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-06-21 15:08:30 +0000 |
| commit | e0eb66bbff5e4307c54e4f5c52e711b4b1b05126 (patch) | |
| tree | 97710dbd81dbe43fa6d6ca300aa565aa1d413bfa /clang/lib | |
| parent | b0ba049f58b38f273b9eb531d9da1df30ad5033f (diff) | |
| download | bcm5719-llvm-e0eb66bbff5e4307c54e4f5c52e711b4b1b05126.tar.gz bcm5719-llvm-e0eb66bbff5e4307c54e4f5c52e711b4b1b05126.zip | |
[OPENMP]Fix PR42159: do not capture threadprivate variables.
The threadprivate variables should not be captured in the outlined
regions, otherwise it leads to the compiler crash.
llvm-svn: 364061
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 19057eb3986..b531d31c1ca 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1866,11 +1866,14 @@ VarDecl *Sema::isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo, DSAStack->getTopDSA(D, DSAStack->isClauseParsingMode()); if (DVarPrivate.CKind != OMPC_unknown && isOpenMPPrivate(DVarPrivate.CKind)) return VD ? VD : cast<VarDecl>(DVarPrivate.PrivateCopy->getDecl()); + // Threadprivate variables must not be captured. + if (isOpenMPThreadPrivate(DVarPrivate.CKind)) + return nullptr; + // The variable is not private or it is the variable in the directive with + // default(none) clause and not used in any clause. DVarPrivate = DSAStack->hasDSA(D, isOpenMPPrivate, [](OpenMPDirectiveKind) { return true; }, DSAStack->isClauseParsingMode()); - // The variable is not private or it is the variable in the directive with - // default(none) clause and not used in any clause. if (DVarPrivate.CKind != OMPC_unknown || (VD && DSAStack->getDefaultDSA() == DSA_none)) return VD ? VD : cast<VarDecl>(DVarPrivate.PrivateCopy->getDecl()); |

