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 | 292e98cc182d9f651f8366c0f3670ddf87bb1f6d (patch) | |
tree | db1b616b4492ec5d0cd80c1d83f4e8a6006561b7 /clang/lib/CodeGen | |
parent | 0e56c82e4a09c967e33c1db3a7ce8f2368dd61fc (diff) | |
download | bcm5719-llvm-292e98cc182d9f651f8366c0f3670ddf87bb1f6d.tar.gz bcm5719-llvm-292e98cc182d9f651f8366c0f3670ddf87bb1f6d.zip |
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?
llvm-svn: 51558
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index bdd7975fa0c..9daa21eb340 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/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; } |