aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-16 18:40:08 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-16 18:40:08 +0000
commit4af33c260559bb3715da2c84be637156473d731c (patch)
treec3daeb13fb79309e33b6710e5dd0abb51681d3e7
parent1e0f33873b9fa10599c715eba2a9e64a8cdb2af5 (diff)
Add a test case for bit accurate integer types in llvm-gcc. This is
XFAILed for now until llvm-gcc changes are committed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33261 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CFrontend/bit-accurate-int.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CFrontend/bit-accurate-int.c b/test/CFrontend/bit-accurate-int.c
new file mode 100644
index 0000000000..a2138bc7d2
--- /dev/null
+++ b/test/CFrontend/bit-accurate-int.c
@@ -0,0 +1,35 @@
+// RUN: %llvmgcc -S %s -o - /dev/null
+// XFAIL: *
+
+#define ATTR_BITS(N) __attribute__((bitwidth(N)))
+
+typedef int ATTR_BITS( 4) My04BitInt;
+typedef int ATTR_BITS(16) My16BitInt;
+typedef int ATTR_BITS(17) My17BitInt;
+typedef int ATTR_BITS(37) My37BitInt;
+typedef int ATTR_BITS(65) My65BitInt;
+
+struct MyStruct {
+ My04BitInt i4Field;
+ short ATTR_BITS(12) i12Field;
+ long ATTR_BITS(17) i17Field;
+ My37BitInt i37Field;
+};
+
+My37BitInt doit( short ATTR_BITS(23) num) {
+ My17BitInt i;
+ struct MyStruct strct;
+ int bitsize1 = sizeof(My17BitInt);
+ int __attribute__((bitwidth(9))) j;
+ int bitsize2 = sizeof(j);
+ int result = bitsize1 + bitsize2;
+ strct.i17Field = result;
+ result += sizeof(struct MyStruct);
+ return result;
+}
+
+int
+main ( int argc, char** argv)
+{
+ return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
+}