1 // RUN: %clangxx_asan -O0 %s -o %t && not %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
2 // RUN: %clangxx_asan -O1 %s -o %t && not %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
3 // RUN: %clangxx_asan -O2 %s -o %t && not %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
4 // RUN: %clangxx_asan -O3 %s -o %t && not %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
7 __attribute__((noinline
))
8 static void LargeFunction(int *x
, int zero
) {
20 // CHECK: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
21 // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}
22 // CHECK: {{READ of size 4 at 0x.* thread T0}}
23 x
[zero
+ 103]++; // we should report this exact line
24 // atos incorrectly extracts the symbol name for the static functions on
26 // CHECK-Linux: {{#0 0x.* in LargeFunction.*large_func_test.cc:}}[[@LINE-3]]
27 // CHECK-Darwin: {{#0 0x.* in .*LargeFunction.*large_func_test.cc}}:[[@LINE-4]]
41 int main(int argc
, char **argv
) {
42 int *x
= new int[100];
43 LargeFunction(x
, argc
- 1);
44 // CHECK: {{ #1 0x.* in main .*large_func_test.cc:}}[[@LINE-1]]
45 // CHECK: {{0x.* is located 12 bytes to the right of 400-byte region}}
46 // CHECK: {{allocated by thread T0 here:}}
47 // CHECK-Linux: {{ #0 0x.* in operator new.*}}
48 // CHECK-Darwin: {{ #0 0x.* in .*_Zna.*}}
49 // CHECK: {{ #1 0x.* in main .*large_func_test.cc:}}[[@LINE-7]]