From 423f3a0bc05b8bab9148e9bff9234bcefeac9faf Mon Sep 17 00:00:00 2001 From: Kuba Brecka Date: Fri, 5 Dec 2014 21:05:04 +0000 Subject: [PATCH] AddressSanitizer - Don't instrument globals from cstring_literals sections. (compiler-rt part) Reviewed at http://reviews.llvm.org/D6488 llvm-svn: 223514 --- compiler-rt/test/asan/TestCases/Darwin/objc-odr.mm | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 compiler-rt/test/asan/TestCases/Darwin/objc-odr.mm 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 index 0000000..72bc39c --- /dev/null +++ b/compiler-rt/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 + +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 -- 2.7.4