llvm.org GIT mirror llvm / 85f74f8
Test for llvm-gcc bug fixed by 70301. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70302 91177308-0d34-0410-b5e6-96231b3b80d8 Dale Johannesen 11 years ago
1 changed file(s) with 127 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 // RUN: %llvmgcc -S -x objective-c -m32 %s -o %t
1 // This used to crash, 6831493.
2 #include
3
4 struct s0 {
5 double x;
6 };
7
8 @interface I2 {
9 struct s0 _iv1;
10 }
11 @end
12
13 @interface I3 : I2 {
14 unsigned int _iv2 :1;
15 unsigned : 0;
16 unsigned int _iv3 : 3;
17 }
18 @end
19
20 @interface I4 : I3 {
21 char _iv4;
22 }
23 @end
24
25 @interface I5 : I4 {
26 char _iv5;
27 int _iv6;
28 int _iv7;
29 }
30
31 @property int P1;
32 @end
33
34 @implementation I2
35 @end
36
37 @implementation I3
38 @end
39
40 @implementation I4
41 @end
42
43 @interface I5 ()
44 @property int P2;
45 @end
46
47 #if 0
48 int g2 = sizeof(I2);
49 int g3 = sizeof(I3);
50 int g4 = sizeof(I4);
51 int g5_0 = sizeof(I5);
52 #endif
53
54 @implementation I5
55 #ifdef __x86_64
56 @synthesize P1 = _MadeUpName;
57 @synthesize P2 = _AnotherMadeUpName;
58 #else
59 @synthesize P1 = _iv6;
60 @synthesize P2 = _iv7;
61 #endif
62 @end
63
64 #if 0
65 int g5_1 = sizeof(I5);
66 #endif
67
68 @interface T0_I0 {
69 double iv_A_0;
70 char iv_A_1;
71 }
72 @end
73
74 @interface T0_I1 : T0_I0 {
75 char iv_B_0;
76 }
77 @end
78
79 @interface T0_I2 : T0_I1 {
80 char iv_C_0;
81 }
82 @end
83
84 #if 0
85 int g6 = sizeof(T0_I0);
86 int g7 = sizeof(T0_I1);
87 int g8 = sizeof(T0_I2);
88 #endif
89
90 @implementation T0_I0 @end
91 @implementation T0_I1 @end
92 @implementation T0_I2 @end
93
94 void f0(I2*i2,I3*i3,I4*i4,I5*i5,T0_I0*t0_i0,T0_I1*t0_i1,T0_I2*t0_i2) {
95 }
96
97 // Thomas Wang's ui32 hash.
98 unsigned hash_ui32_to_ui32(unsigned a) {
99 a = (a ^ 61) ^ (a >> 16);
100 a = a + (a << 3);
101 a = a ^ (a >> 4);
102 a = a * 0x27d4eb2d;
103 a = a ^ (a >> 15);
104 return a;
105 }
106
107 unsigned char hash_ui32_to_ui8(unsigned ui) {
108 ui = hash_ui32_to_ui32(ui);
109 ui ^= ui>>8;
110 ui ^= ui>>8;
111 ui ^= ui>>8;
112 return (unsigned char) ui;
113 }
114
115 void *init() {
116 unsigned i, N = 1024;
117 unsigned char *p = malloc(N);
118 for (i=0; i != N; ++i)
119 p[i] = hash_ui32_to_ui8(i);
120 return p;
121 }
122
123 int main(){
124 void *p = init();
125 f0(p,p,p,p,p,p,p);
126 }