Make test more lenient for custom clang version strings
[llvm-project.git] / compiler-rt / test / asan / TestCases / large_func_test.cpp
blobc64fc7d3c7aa74560b524d152e6a398fe5e9de0f
1 // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
2 // RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
3 // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
4 // RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
5 // REQUIRES: stable-runtime
7 // Issue #108194: Incomplete .debug_line at -O1 and above.
8 // XFAIL: target={{.*sparc.*}}
10 #include <stdlib.h>
11 __attribute__((noinline))
12 static void LargeFunction(int *x, int zero) {
13 x[0]++;
14 x[1]++;
15 x[2]++;
16 x[3]++;
17 x[4]++;
18 x[5]++;
19 x[6]++;
20 x[7]++;
21 x[8]++;
22 x[9]++;
24 // CHECK: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
25 // CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}
26 // CHECK: {{READ of size 4 at 0x.* thread T0}}
27 x[zero + 103]++; // we should report this exact line
28 // atos incorrectly extracts the symbol name for the static functions on
29 // Darwin.
30 // CHECK-Linux: {{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-3]]
31 // CHECK-SunOS: {{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-4]]
32 // CHECK-Windows:{{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-5]]
33 // CHECK-FreeBSD:{{#0 0x.* in LargeFunction.*large_func_test.cpp:}}[[@LINE-6]]
34 // CHECK-Darwin: {{#0 0x.* in .*LargeFunction.*large_func_test.cpp}}:[[@LINE-7]]
36 x[10]++;
37 x[11]++;
38 x[12]++;
39 x[13]++;
40 x[14]++;
41 x[15]++;
42 x[16]++;
43 x[17]++;
44 x[18]++;
45 x[19]++;
48 int main(int argc, char **argv) {
49 int *x = new int[100];
50 LargeFunction(x, argc - 1);
51 // CHECK: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-1]]
52 // CHECK: {{0x.* is located 12 bytes after 400-byte region}}
53 // CHECK: {{allocated by thread T0 here:}}
54 // CHECK-Linux: {{ #0 0x.* in operator new}}
55 // CHECK-SunOS: {{ #0 0x.* in operator new}}
56 // CHECK-Windows:{{ #0 0x.* in operator new}}
57 // CHECK-FreeBSD:{{ #0 0x.* in operator new}}
58 // CHECK-Darwin: {{ #0 0x.* in .*_Zna}}
59 // CHECK-NEXT: {{ #1 0x.* in main .*large_func_test.cpp:}}[[@LINE-10]]
60 int y = x[argc];
61 delete[] x;
62 return y;