diff options
author | John McCall <rjmccall@apple.com> | 2010-12-06 06:10:02 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-06 06:10:02 +0000 |
commit | d0a300162ebea20706866399c82adfe5abf6d924 (patch) | |
tree | 99caa86fad5b9565cac63158ebb1f7973b9013b0 /clang/lib/CodeGen/CGExprAgg.cpp | |
parent | 0d025b6b42111f1ebab71ea000172dfe821551b6 (diff) | |
download | bcm5719-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.cpp | 2 |
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 |