summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Darwin/objc-odr.mm
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Darwin/objc-odr.mm')
-rw-r--r--test/asan/TestCases/Darwin/objc-odr.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/asan/TestCases/Darwin/objc-odr.mm b/test/asan/TestCases/Darwin/objc-odr.mm
new file mode 100644
index 0000000000000..72bc39c80dd4c
--- /dev/null
+++ b/test/asan/TestCases/Darwin/objc-odr.mm
@@ -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