summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-11-07 18:15:02 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-11-07 18:15:02 +0000
commit611b0a11dfb49c8cbefabf0f582031088758b9cd (patch)
treeb64e2c2fcadb557906db77ce41c1573828b6a5ce /clang/lib/CodeGen
parent18082abfc2e59cbeff0273f937fc3e9f88e0c160 (diff)
downloadbcm5719-llvm-611b0a11dfb49c8cbefabf0f582031088758b9cd.tar.gz
bcm5719-llvm-611b0a11dfb49c8cbefabf0f582031088758b9cd.zip
[OPENMP] Fixed codegen for __real/__imag expressions in atomic
constructs. For __real/__imag unary expressions clang emits lvalue with the associated type from the original complex expression, but not the underlying builtin integer or float type. This causes crash in codegen for atomic constructs, if __real/__imag expression are used in atomic constructs. llvm-svn: 286129
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index a5eee2e4120..08e1cad5305 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2276,13 +2276,15 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
return LV;
}
- assert(E->getSubExpr()->getType()->isAnyComplexType());
+ QualType T = ExprTy->castAs<ComplexType>()->getElementType();
Address Component =
(E->getOpcode() == UO_Real
? emitAddrOfRealComponent(LV.getAddress(), LV.getType())
: emitAddrOfImagComponent(LV.getAddress(), LV.getType()));
- return MakeAddrLValue(Component, ExprTy, LV.getAlignmentSource());
+ LValue ElemLV = MakeAddrLValue(Component, T, LV.getAlignmentSource());
+ ElemLV.getQuals().addQualifiers(LV.getQuals());
+ return ElemLV;
}
case UO_PreInc:
case UO_PreDec: {
OpenPOWER on IntegriCloud