summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/packed-union.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-02 17:51:33 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-02 17:51:33 +0000
commit09a3774cd394379adae4fae72942c05ac48876a1 (patch)
treebb2f15c0357087b46ff8336ddfb0d5e8d629025a /clang/test/CodeGen/packed-union.c
parent7bd37b47c8641422877f2ad01089836a3c5f9f55 (diff)
downloadbcm5719-llvm-09a3774cd394379adae4fae72942c05ac48876a1.tar.gz
bcm5719-llvm-09a3774cd394379adae4fae72942c05ac48876a1.zip
Packed unions should be packed. Fixes an assert Daniel reported.
llvm-svn: 80808
Diffstat (limited to 'clang/test/CodeGen/packed-union.c')
-rw-r--r--clang/test/CodeGen/packed-union.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/CodeGen/packed-union.c b/clang/test/CodeGen/packed-union.c
new file mode 100644
index 00000000000..d11d3a49023
--- /dev/null
+++ b/clang/test/CodeGen/packed-union.c
@@ -0,0 +1,16 @@
+// RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm %s -o %t &&
+
+// RUN: grep "struct._attrs = type <{ i32, i8 }>" %t &&
+typedef struct _attrs {
+ unsigned file_attributes;
+ unsigned char filename_length;
+} __attribute__((__packed__)) attrs;
+
+// RUN: grep "union._attr_union = type <{ i32, i8 }>" %t
+typedef union _attr_union {
+ attrs file_attrs;
+ unsigned owner_id;
+} __attribute__((__packed__)) attr_union;
+
+attr_union u;
+
OpenPOWER on IntegriCloud