[llvm-commits] [test-suite] r130798 - /test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c
Fariborz Jahanian
fjahanian at apple.com
Tue May 3 15:17:46 PDT 2011
Author: fjahanian
Date: Tue May 3 17:17:46 2011
New Revision: 130798
URL: http://llvm.org/viewvc/llvm-project?rev=130798&view=rev
Log:
More unit tests for ms_struct and zero-length
bitfield alignment rules.
Modified:
test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c
Modified: test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c?rev=130798&r1=130797&r2=130798&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c (original)
+++ test-suite/trunk/SingleSource/UnitTests/ms_struct-bitfield-init-1.c Tue May 3 17:17:46 2011
@@ -42,6 +42,44 @@
} ATTR t5 = {7,8};
static int a5[(sizeof(t5) == 4) -1];
+struct
+{
+ char foo : 4;
+ short : 0;
+ long :0;
+ char bar;
+} ATTR t6 = {5, 10};
+static int a6[(sizeof(t6) == 4) -1];
+
+struct
+{
+ char foo : 4;
+ int :0;
+ short : 0;
+ char bar;
+} ATTR t7 = {5, 10};
+static int a7[(sizeof(t7) == 8) -1];
+
+struct
+{
+ char foo : 4;
+ short : 0;
+ int :0;
+ char bar:7;
+} ATTR t8 = {5, 10};
+static int a8[(sizeof(t8) == 4) -1];
+
+struct
+{
+ char foo : 4;
+ char : 0;
+ short : 0;
+ int : 0;
+ long :0;
+ char bar;
+} ATTR t10 = {5, 10};
+static int a10[(sizeof(t10) == 2) -1];
+
int main() {
if (t1.bf_1 != 1 || t1.bf_2 != 2)
abort();
@@ -51,6 +89,14 @@
abort();
if (t5.foo != 7 || t5.bar != 8)
abort();
+ if (t6.foo != 5 || t6.bar != 10)
+ abort();
+ if (t7.foo != 5 || t7.bar != 10)
+ abort();
+ if (t8.foo != 5 || t8.bar != 10)
+ abort();
+ if (t10.foo != 5 || t10.bar != 10)
+ abort();
return 0;
}
More information about the llvm-commits
mailing list