diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-04 11:26:21 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-04 11:26:21 +0000 |
commit | caacd53dde6ea46d03abf272aa996957433ce31d (patch) | |
tree | c3edcda81f236070fc44b8cd5f00528a8b9e8f88 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | cb405bf311d38c720601ad9cdac787d83f1a9e6f (diff) | |
download | bcm5719-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/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index c42dd959f1f..22f6f6c5a56 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -584,7 +584,15 @@ public: if (SavedLocals.count(LocalVD) > 0) return false; SavedLocals[LocalVD] = CGF.LocalDeclMap.lookup(LocalVD); CGF.LocalDeclMap.erase(LocalVD); - SavedPrivates[LocalVD] = PrivateGen(); + auto *V = PrivateGen(); + QualType VarTy = LocalVD->getType(); + if (VarTy->isReferenceType()) { + auto *TempAlloca = CGF.CreateMemTemp(VarTy); + LValue RefLVal = CGF.MakeNaturalAlignAddrLValue(TempAlloca, VarTy); + CGF.EmitStoreOfScalar(V, RefLVal); + V = TempAlloca; + } + SavedPrivates[LocalVD] = V; CGF.LocalDeclMap[LocalVD] = SavedLocals[LocalVD]; return true; } |