new testcase for PR1253
[oota-llvm.git] / test / CFrontend / bit-accurate-int.c
1 // RUN: %llvmgcc -S %s -o - /dev/null 2>&1 > /dev/null | \
2 // RUN:   not grep warning
3 // XFAIL: *
4
5 #define ATTR_BITS(N) __attribute__((bitwidth(N))) 
6
7 typedef int ATTR_BITS( 4) My04BitInt;
8 typedef int ATTR_BITS(16) My16BitInt;
9 typedef int ATTR_BITS(17) My17BitInt;
10 typedef int ATTR_BITS(37) My37BitInt;
11 typedef int ATTR_BITS(65) My65BitInt;
12
13 struct MyStruct {
14   My04BitInt i4Field;
15   short ATTR_BITS(12) i12Field;
16   long ATTR_BITS(17) i17Field;
17   My37BitInt i37Field;
18 };
19
20 My37BitInt doit( short ATTR_BITS(23) num) {
21   My17BitInt i;
22   struct MyStruct strct;
23   int bitsize1 = sizeof(My17BitInt);
24   int __attribute__((bitwidth(9))) j;
25   int bitsize2 = sizeof(j);
26   int result = bitsize1 + bitsize2;
27   strct.i17Field = result;
28   result += sizeof(struct MyStruct);
29   return result;
30 }
31
32 int
33 main ( int argc, char** argv)
34 {
35   return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
36 }