When removing a function from the function set and adding it to deferred, we
[llvm.git] / test / FrontendObjC / 2009-04-28-bitfield-vs-vbc.m
blob8306fcc7e07f553cdea215859176488b75890b1f
1 // RUN: %llvmgcc -S -x objective-c -m32 %s -o %t
2 // This used to crash, 6831493.
3 #include <stdlib.h>
5 struct s0 {
6   double x;
7 };
9 @interface I2 {
10   struct s0 _iv1;
12 @end
14 @interface I3 : I2 {
15   unsigned int _iv2 :1;
16   unsigned : 0;
17   unsigned int _iv3 : 3;
19 @end
21 @interface I4 : I3 {
22   char _iv4;
24 @end
26 @interface I5 : I4 {
27   char _iv5;
28   int _iv6;
29   int _iv7;
32 @property int P1;
33 @end
35 @implementation I2
36 @end
38 @implementation I3
39 @end
41 @implementation I4 
42 @end
44 @interface I5 ()
45 @property int P2;
46 @end
48 #if 0
49 int g2 = sizeof(I2);
50 int g3 = sizeof(I3);
51 int g4 = sizeof(I4);
52 int g5_0 = sizeof(I5);
53 #endif
55 @implementation I5
56 #ifdef __x86_64
57 @synthesize P1 = _MadeUpName;
58 @synthesize P2 = _AnotherMadeUpName;
59 #else
60 @synthesize P1 = _iv6;
61 @synthesize P2 = _iv7;
62 #endif
63 @end
65 #if 0
66 int g5_1 = sizeof(I5);
67 #endif
69 @interface T0_I0 {
70   double iv_A_0;
71   char iv_A_1;
73 @end
75 @interface T0_I1 : T0_I0 {
76   char iv_B_0;
78 @end
80 @interface T0_I2 : T0_I1 {
81   char iv_C_0;
83 @end
85 #if 0
86 int g6 = sizeof(T0_I0);
87 int g7 = sizeof(T0_I1);
88 int g8 = sizeof(T0_I2);
89 #endif
90   
91 @implementation T0_I0 @end
92 @implementation T0_I1 @end  
93 @implementation T0_I2 @end
95 void f0(I2*i2,I3*i3,I4*i4,I5*i5,T0_I0*t0_i0,T0_I1*t0_i1,T0_I2*t0_i2) {
98 // Thomas Wang's ui32 hash.
99 unsigned hash_ui32_to_ui32(unsigned a) {
100   a = (a ^ 61) ^ (a >> 16);
101   a = a + (a << 3);
102   a = a ^ (a >> 4);
103   a = a * 0x27d4eb2d;
104   a = a ^ (a >> 15);
105   return a;
108 unsigned char hash_ui32_to_ui8(unsigned ui) {
109   ui = hash_ui32_to_ui32(ui);
110   ui ^= ui>>8;
111   ui ^= ui>>8;
112   ui ^= ui>>8;
113   return (unsigned char) ui;
116 void *init() {
117   unsigned i, N = 1024;
118   unsigned char *p = malloc(N);
119   for (i=0; i != N; ++i)
120     p[i] = hash_ui32_to_ui8(i);
121   return p;
124 int main(){
125   void *p = init();
126   f0(p,p,p,p,p,p,p);