aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/const-init.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-02 02:15:20 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-02 02:15:20 +0000
commit31f2f9ced8ed2dd17ac43b6addc84eb08a05442e (patch)
treeef58f58db1378ce4488f3beec5d56b04d9a75264 /test/CodeGen/const-init.c
parentb2f81cf7f8445e0c65c0428f4fbb0442566916b8 (diff)
When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83230 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/const-init.c')
-rw-r--r--test/CodeGen/const-init.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 278d84fc56..13bfcd9cdf 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o %t %s &&
+// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o %t %s | FileCheck %s --input-file=%t &&
#include <stdint.h>
@@ -47,6 +47,12 @@ int g9 = (2 + 3i) * (5 + 7i) != (-11 + 29i);
// RUN: grep '@g10 = global i32 0' %t &&
int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
+// PR5108
+// CHECK: @ss = global %4 <{ i32 0, i8 7 }>, align 1
+struct s {
+ unsigned long a;
+ unsigned long b:3;
+} __attribute__((__packed__)) ss = { .a = 0x0, .b = 7, };
// Global references
// RUN: grep '@g11.l0 = internal global i32 ptrtoint (i32 ()\* @g11 to i32)' %t &&