]> granicus.if.org Git - clang/commitdiff
Obvious fix for PR5474.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 13 Nov 2009 21:23:46 +0000 (21:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 13 Nov 2009 21:23:46 +0000 (21:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88696 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprConstant.cpp
test/CodeGen/const-init.c

index 3578617491ba55d3a678d2ddac8ba2ea4f67616b..644ec107e95e89c11b4be54ad98ca66494efb02a 100644 (file)
@@ -262,7 +262,7 @@ class VISIBILITY_HIDDEN ConstStructBuilder {
         uint64_t NumBytes =
           AlignedElementOffsetInBytes - ElementOffsetInBytes;
 
-        const llvm::Type *Ty = llvm::Type::getInt8Ty(CGF->getLLVMContext());
+        const llvm::Type *Ty = llvm::Type::getInt8Ty(CGM.getLLVMContext());
         if (NumBytes > 1)
           Ty = llvm::ArrayType::get(Ty, NumBytes);
 
index e25da9c6eba047d7eff5d57f3fe9188b30aaf198..caef3e14c07fea330ecc81befb0a933e6f49ca2e 100644 (file)
@@ -111,3 +111,9 @@ void *g20(void) {
 // PR4108
 struct g21 {int g21;};
 const struct g21 g21 = (struct g21){1};
+
+// PR5474
+struct g22 {int x;} __attribute((packed));
+struct g23 {char a; short b; char c; struct g22 d;};
+struct g23 g24 = {1,2,3,4};
+