summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-09-04 11:26:21 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-09-04 11:26:21 +0000
commitcaacd53dde6ea46d03abf272aa996957433ce31d (patch)
treec3edcda81f236070fc44b8cd5f00528a8b9e8f88 /clang/lib/CodeGen/CGStmtOpenMP.cpp
parentcb405bf311d38c720601ad9cdac787d83f1a9e6f (diff)
downloadbcm5719-llvm-caacd53dde6ea46d03abf272aa996957433ce31d.tar.gz
bcm5719-llvm-caacd53dde6ea46d03abf272aa996957433ce31d.zip
[OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trap
Fix processing of shared variables with reference types in OpenMP constructs. Previously, if the variable was not marked in one of the private clauses, the reference to this variable was emitted incorrectly and caused an assertion later. llvm-svn: 246846
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index b5e7db53508..0e87c3844ba 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -383,6 +383,12 @@ void CodeGenFunction::EmitOMPLastprivateClauseFinal(
auto *OriginalAddr = GetAddrOfLocalVar(DestVD);
// Get the address of the private variable.
auto *PrivateAddr = GetAddrOfLocalVar(PrivateVD);
+ if (PrivateVD->getType()->isReferenceType())
+ PrivateAddr =
+ EmitLoadOfLValue(MakeNaturalAlignAddrLValue(
+ PrivateAddr, PrivateVD->getType()),
+ (*IRef)->getExprLoc())
+ .getScalarVal();
EmitOMPCopy(*this, Type, OriginalAddr, PrivateAddr, DestVD, SrcVD,
AssignOp);
}
OpenPOWER on IntegriCloud