Recommit of r223513 and r223514.
authorKuba Brecka <kuba.brecka@gmail.com>
Fri, 5 Dec 2014 22:19:35 +0000 (22:19 +0000)
committerKuba Brecka <kuba.brecka@gmail.com>
Fri, 5 Dec 2014 22:19:35 +0000 (22:19 +0000)
Reviewed at http://reviews.llvm.org/D6488

llvm-svn: 223533

compiler-rt/test/asan/TestCases/Darwin/objc-odr.mm [new file with mode: 0644]

diff --git a/compiler-rt/test/asan/TestCases/Darwin/objc-odr.mm b/compiler-rt/test/asan/TestCases/Darwin/objc-odr.mm
new file mode 100644 (file)
index 0000000..72bc39c
--- /dev/null
@@ -0,0 +1,23 @@
+// Regression test for
+// https://code.google.com/p/address-sanitizer/issues/detail?id=360.
+
+// RUN: %clang_asan %s -o %t -framework Foundation
+// RUN: %run %t 2>&1 | FileCheck %s
+
+#import <Foundation/Foundation.h>
+
+void f() {
+    int y = 7;
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            printf("num = %d\n", y);
+        });
+    });
+}
+
+int main() {
+  NSLog(@"Hello world");
+}
+
+// CHECK-NOT: AddressSanitizer: odr-violation
+// CHECK: Hello world