[llvm-commits] [llvm] r70302 - /llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m
Dale Johannesen
dalej at apple.com
Tue Apr 28 10:16:30 PDT 2009
Author: johannes
Date: Tue Apr 28 12:16:30 2009
New Revision: 70302
URL: http://llvm.org/viewvc/llvm-project?rev=70302&view=rev
Log:
Test for llvm-gcc bug fixed by 70301.
Added:
llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m
Added: llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m?rev=70302&view=auto
==============================================================================
--- llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m (added)
+++ llvm/trunk/test/FrontendObjC/2009-04-28-bitfield-vs-vbc.m Tue Apr 28 12:16:30 2009
@@ -0,0 +1,127 @@
+// RUN: %llvmgcc -S -x objective-c -m32 %s -o %t
+// This used to crash, 6831493.
+#include <stdlib.h>
+
+struct s0 {
+ double x;
+};
+
+ at interface I2 {
+ struct s0 _iv1;
+}
+ at end
+
+ at interface I3 : I2 {
+ unsigned int _iv2 :1;
+ unsigned : 0;
+ unsigned int _iv3 : 3;
+}
+ at end
+
+ at interface I4 : I3 {
+ char _iv4;
+}
+ at end
+
+ at interface I5 : I4 {
+ char _iv5;
+ int _iv6;
+ int _iv7;
+}
+
+ at property int P1;
+ at end
+
+ at implementation I2
+ at end
+
+ at implementation I3
+ at end
+
+ at implementation I4
+ at end
+
+ at interface I5 ()
+ at property int P2;
+ at end
+
+#if 0
+int g2 = sizeof(I2);
+int g3 = sizeof(I3);
+int g4 = sizeof(I4);
+int g5_0 = sizeof(I5);
+#endif
+
+ at implementation I5
+#ifdef __x86_64
+ at synthesize P1 = _MadeUpName;
+ at synthesize P2 = _AnotherMadeUpName;
+#else
+ at synthesize P1 = _iv6;
+ at synthesize P2 = _iv7;
+#endif
+ at end
+
+#if 0
+int g5_1 = sizeof(I5);
+#endif
+
+ at interface T0_I0 {
+ double iv_A_0;
+ char iv_A_1;
+}
+ at end
+
+ at interface T0_I1 : T0_I0 {
+ char iv_B_0;
+}
+ at end
+
+ at interface T0_I2 : T0_I1 {
+ char iv_C_0;
+}
+ at end
+
+#if 0
+int g6 = sizeof(T0_I0);
+int g7 = sizeof(T0_I1);
+int g8 = sizeof(T0_I2);
+#endif
+
+ at implementation T0_I0 @end
+ at implementation T0_I1 @end
+ at implementation T0_I2 @end
+
+void f0(I2*i2,I3*i3,I4*i4,I5*i5,T0_I0*t0_i0,T0_I1*t0_i1,T0_I2*t0_i2) {
+}
+
+// Thomas Wang's ui32 hash.
+unsigned hash_ui32_to_ui32(unsigned a) {
+ a = (a ^ 61) ^ (a >> 16);
+ a = a + (a << 3);
+ a = a ^ (a >> 4);
+ a = a * 0x27d4eb2d;
+ a = a ^ (a >> 15);
+ return a;
+}
+
+unsigned char hash_ui32_to_ui8(unsigned ui) {
+ ui = hash_ui32_to_ui32(ui);
+ ui ^= ui>>8;
+ ui ^= ui>>8;
+ ui ^= ui>>8;
+ return (unsigned char) ui;
+}
+
+void *init() {
+ unsigned i, N = 1024;
+ unsigned char *p = malloc(N);
+ for (i=0; i != N; ++i)
+ p[i] = hash_ui32_to_ui8(i);
+ return p;
+}
+
+int main(){
+ void *p = init();
+ f0(p,p,p,p,p,p,p);
+}
More information about the llvm-commits
mailing list