Make test more lenient for custom clang version strings
[llvm-project.git] / compiler-rt / test / asan / TestCases / use-after-scope-inlined.cpp
blob1014ff919b9ef82262cdf2df9774282b37b0f32c
1 // Test with "-O2" only to make sure inlining (leading to use-after-scope)
2 // happens. "always_inline" is not enough, as Clang doesn't emit
3 // llvm.lifetime intrinsics at -O0.
4 //
5 // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
7 int *arr;
9 __attribute__((always_inline))
10 void inlined(int arg) {
11 int x[5];
12 for (int i = 0; i < arg; i++) x[i] = i;
13 arr = x;
16 int main(int argc, char *argv[]) {
17 inlined(argc);
18 return arr[argc - 1]; // BOOM
19 // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
20 // CHECK: READ of size 4 at 0x{{.*}} thread T0
21 // CHECK: #0 0x{{.*}} in main
22 // CHECK: {{.*}}use-after-scope-inlined.cpp:[[@LINE-4]]
23 // CHECK: Address 0x{{.*}} is located in stack of thread T0 at offset [[OFFSET:[^ ]*]] in frame
24 // CHECK: {{.*}} in main
25 // CHECK: This frame has
26 // CHECK: {{\[}}[[OFFSET]], {{.*}}) 'x.i' (line [[@LINE-15]])