Add a test case that Objective-C bitfield access doesn't reach past end of
structure.
llvm-svn: 112911
diff --git a/SingleSource/UnitTests/ObjC/bitfield-access.m b/SingleSource/UnitTests/ObjC/bitfield-access.m
new file mode 100644
index 0000000..948918b
--- /dev/null
+++ b/SingleSource/UnitTests/ObjC/bitfield-access.m
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+@interface I0 {
+@public
+ unsigned a:15;
+ unsigned b: 9;
+}
+@end
+
+@implementation I0
+@end
+
+void f0(I0 *s) {
+ s->b = 1;
+}
+
+int main() {
+ char *p = valloc(4096*2);
+ mprotect(p+4096, 4096, 0);
+ I0 *s = (I0 *)(p+4096-4);
+
+ f0(s);
+
+ return 0;
+}
diff --git a/SingleSource/UnitTests/ObjC/bitfield-access.reference_output b/SingleSource/UnitTests/ObjC/bitfield-access.reference_output
new file mode 100644
index 0000000..ca916d0
--- /dev/null
+++ b/SingleSource/UnitTests/ObjC/bitfield-access.reference_output
@@ -0,0 +1 @@
+exit 0