| 1 | // Regression test for |
| 2 | // https://code.google.com/p/address-sanitizer/issues/detail?id=360. |
| 3 | |
| 4 | // RUN: %clang_asan %s -o %t -framework Foundation |
| 5 | // RUN: %run %t 2>&1 | FileCheck %s |
| 6 | |
| 7 | #import <Foundation/Foundation.h> |
| 8 | |
| 9 | void f() { |
| 10 | int y = 7; |
| 11 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ |
| 12 | dispatch_sync(dispatch_get_main_queue(), ^{ |
| 13 | printf("num = %d\n" , y); |
| 14 | }); |
| 15 | }); |
| 16 | } |
| 17 | |
| 18 | int main() { |
| 19 | fprintf(stderr,"Hello world" ); |
| 20 | } |
| 21 | |
| 22 | // CHECK-NOT: AddressSanitizer: odr-violation |
| 23 | // CHECK: Hello world |
| 24 | |