aboutsummaryrefslogblamecommitdiff
path: root/test/asan/TestCases/Darwin/objc-odr.mm
blob: c4c240ee419cc05cd36d98322a764fc45e590dc2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                                                       
                                



                                             
// 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() {
  fprintf(stderr,"Hello world");
}

// CHECK-NOT: AddressSanitizer: odr-violation
// CHECK: Hello world