Fix bitfield accesses which straddle the boundary of the underlying
type.
- This generates somewhat less optimal code than before but this is
not hard to rectify once stable (at the cost of slightly more
complex code).
- This currently always uses little-endian ordering of the bitfield.
- This breaks the CodeGen/bitfield.c test because it was grepping for
hard-coded assembly instructions. Will fix once a better test case
is constructed (hard to do without execution).
- This fixes SingleSource/UnitTests/2006-01-23-InitializedBitField.c
and Regression/C/PR1386.c from the test suite.
- <rdar://problem/6085090>, <rdar://problem/6094169>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54395 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/2008-07-22-packed-bitfield-access.c b/test/CodeGen/2008-07-22-packed-bitfield-access.c
new file mode 100644
index 0000000..b41b5e0
--- /dev/null
+++ b/test/CodeGen/2008-07-22-packed-bitfield-access.c
@@ -0,0 +1,10 @@
+// RUN: clang %s -emit-llvm -o -
+
+int main () {
+ struct foo {
+ unsigned a:16;
+ unsigned b:32 __attribute__ ((packed));
+ } x;
+ x.b = 0x56789abcL;
+ return 0;
+}