[cfe-commits] r111331 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenCXX/expr.cpp
Chris Lattner
sabre at nondot.org
Tue Aug 17 17:08:28 PDT 2010
Author: lattner
Date: Tue Aug 17 19:08:27 2010
New Revision: 111331
URL: http://llvm.org/viewvc/llvm-project?rev=111331&view=rev
Log:
Fix PR7889 by generalizing some over specialized code. There is no
reason that this should be limited to simple lvalues.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGenCXX/expr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=111331&r1=111330&r2=111331&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Aug 17 19:08:27 2010
@@ -1938,10 +1938,8 @@
if (!hasAggregateLLVMType(E->getType())) {
// Emit the LHS as an l-value.
LValue LV = EmitLValue(E->getLHS());
-
- llvm::Value *RHS = EmitScalarExpr(E->getRHS());
- EmitStoreOfScalar(RHS, LV.getAddress(), LV.isVolatileQualified(),
- E->getType());
+ // Sore the value through the l-value.
+ EmitStoreThroughLValue(EmitAnyExpr(E->getRHS()), LV, E->getType());
return LV;
}
Modified: cfe/trunk/test/CodeGenCXX/expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/expr.cpp?rev=111331&r1=111330&r2=111331&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/expr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/expr.cpp Tue Aug 17 19:08:27 2010
@@ -18,3 +18,13 @@
// PR7892
int test3(const char*);
int test3g = test3(__PRETTY_FUNCTION__);
+
+
+// PR7889
+struct test4A {
+ int j : 2;
+};
+int test4() {
+ test4A a;
+ (a.j = 2) = 3;
+}
More information about the cfe-commits
mailing list