]> granicus.if.org Git - clang/commitdiff
Fix a stupid mistake in r151133. Reported to me by Joerg Sonnenberger.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 24 Feb 2012 23:53:49 +0000 (23:53 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 24 Feb 2012 23:53:49 +0000 (23:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
test/CodeGen/init.c

index 6ea21ec47aa5a2240df9ddff3cfe9be9c5009da2..d620d3b953ac7342c15d9adf2b4cd9736d75e243 100644 (file)
@@ -857,10 +857,12 @@ void AggExprEmitter::EmitNullInitializationToLValue(LValue lv) {
     llvm::Value *null = llvm::Constant::getNullValue(CGF.ConvertType(type));
     // Note that the following is not equivalent to
     // EmitStoreThroughBitfieldLValue for ARC types.
-    if (lv.isBitField())
+    if (lv.isBitField()) {
       CGF.EmitStoreThroughBitfieldLValue(RValue::get(null), lv);
-    assert(lv.isSimple());
-    CGF.EmitStoreOfScalar(null, lv, /* isInitialization */ true);
+    } else {
+      assert(lv.isSimple());
+      CGF.EmitStoreOfScalar(null, lv, /* isInitialization */ true);
+    }
   } else {
     // There's a potential optimization opportunity in combining
     // memsets; that would be easy for arrays, but relatively
index 599b4f23dbdc155a79383f1517c3241511c783e8..426233d8dfd3226b5d394c0c36092a292414d2b4 100644 (file)
@@ -123,3 +123,10 @@ struct test12 {
   struct test12 (*p)(void);
 } test12g;
 
+
+void test13(int x) {
+  struct X { int a; int b : 10; int c; };
+  struct X y = {.c = x};
+  // CHECK: @test13
+  // CHECK: and i32 {{.*}}, -1024
+}