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