summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-12-06 06:10:02 +0000
committerJohn McCall <rjmccall@apple.com>2010-12-06 06:10:02 +0000
commitd0a300162ebea20706866399c82adfe5abf6d924 (patch)
tree99caa86fad5b9565cac63158ebb1f7973b9013b0 /clang/lib/CodeGen/CGExprAgg.cpp
parent0d025b6b42111f1ebab71ea000172dfe821551b6 (diff)
downloadbcm5719-llvm-d0a300162ebea20706866399c82adfe5abf6d924.tar.gz
bcm5719-llvm-d0a300162ebea20706866399c82adfe5abf6d924.zip
__block variables require us to evaluate the RHS of an assignment before
the LHS, or else the pointer might be invalid. This is kindof dumb, but go ahead and make sure we're doing that for l-value scalar assignment, which fixes a miscompile of obj-c++.dg/block-seq.mm. Leave a FIXME for how to solve this problem for agg __blocks. llvm-svn: 120992
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 73bb9ef3fb7..ffe1739a0ec 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -389,6 +389,8 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) {
assert(CGF.getContext().hasSameUnqualifiedType(E->getLHS()->getType(),
E->getRHS()->getType())
&& "Invalid assignment");
+
+ // FIXME: __block variables need the RHS evaluated first!
LValue LHS = CGF.EmitLValue(E->getLHS());
// We have to special case property setters, otherwise we must have
OpenPOWER on IntegriCloud