diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-05-25 14:13:57 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-05-25 14:13:57 +0000 |
commit | 1849128c7d88247d914f05efe4c03907f0932174 (patch) | |
tree | df6a36e6c20992d0755ddae24485d32b38ff7410 /lib/CodeGen/CGExprScalar.cpp | |
parent | f84eda37251c679e2f20343c47a4a3586d9a8e21 (diff) |
Fix for PR2001. I'm not really fond of it, but it is correct (unless
someone tries to make a bitfield volatile?).
Not sure how to write a test; any suggestions?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51558 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index bdd7975fa0..9daa21eb34 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -768,6 +768,11 @@ Value *ScalarExprEmitter::EmitCompoundAssign(const CompoundAssignOperator *E, // Store the result value into the LHS lvalue. CGF.EmitStoreThroughLValue(RValue::get(Result), LHSLV, E->getType()); + // For bitfields, we need the value in the bitfield + // FIXME: This adds an extra bitfield load + if (LHSLV.isBitfield()) + Result = EmitLoadOfLValue(LHSLV, LHSTy); + return Result; } @@ -963,7 +968,11 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) { // Store the value into the LHS. // FIXME: Volatility! CGF.EmitStoreThroughLValue(RValue::get(RHS), LHS, E->getType()); - + + // For bitfields, we need the value in the bitfield + // FIXME: This adds an extra bitfield load + if (LHS.isBitfield()) + return EmitLoadOfLValue(LHS, E->getLHS()->getType()); // Return the RHS. return RHS; } |