Fix  "strbuf += stufflen;" crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43365 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExprScalar.cpp b/CodeGen/CGExprScalar.cpp
index 0d86ccc..9bfd82e 100644
--- a/CodeGen/CGExprScalar.cpp
+++ b/CodeGen/CGExprScalar.cpp
@@ -618,8 +618,10 @@
   // Convert the LHS/RHS values to the computation type.
   OpInfo.LHS = EmitScalarConversion(OpInfo.LHS, LHSTy, ComputeType);
   
-  // Do not merge types for -= where the LHS is a pointer.
-  if (E->getOpcode() != BinaryOperator::SubAssign ||
+  // Do not merge types for -= or += where the LHS is a pointer.
+  if (!(E->getOpcode() == BinaryOperator::SubAssign ||
+          E->getOpcode() == BinaryOperator::AddAssign) ||
+  //  if (E->getOpcode() != BinaryOperator::SubAssign ||
       !E->getLHS()->getType()->isPointerType()) {
     OpInfo.RHS = EmitScalarConversion(OpInfo.RHS, RHSTy, ComputeType);
   }
diff --git a/test/CodeGen/compound.c b/test/CodeGen/compound.c
index 778a5ce..0909565 100644
--- a/test/CodeGen/compound.c
+++ b/test/CodeGen/compound.c
@@ -14,3 +14,7 @@
 short x; 
 void test2(char c) { x += c; }
 
+void foo(char *strbuf) {
+  int stufflen = 4;
+  strbuf += stufflen;
+}