[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / compiler-rt / test / msan / stack-origin2.cpp
blob1c9d66a28db270a4c5bd6ce8582785a05dddc3ef
1 // Test that on the second entry to a function the origins are still right.
3 // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
4 // RUN: FileCheck %s < %t.out
5 // RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
6 // RUN: FileCheck %s < %t.out
7 // RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
8 // RUN: FileCheck %s < %t.out
9 // RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
10 // RUN: FileCheck %s < %t.out
12 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
13 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
14 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
15 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
16 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
17 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
18 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
19 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
21 #include <stdlib.h>
23 int t;
25 extern "C" void f(int depth) {
26 if (depth)
27 return f(depth - 1);
29 volatile int x;
30 t = x;
33 int main(int argc, char **argv) {
34 f(1);
35 return t;
36 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
37 // CHECK: {{#0 0x.* in main .*stack-origin2.cpp:}}[[@LINE-2]]
39 // CHECK-ORIGINS: Uninitialized value was created by an allocation of 'x' in the stack frame
40 // CHECK-ORIGINS: {{#0 0x.* in f .*stack-origin2.cpp:}}[[@LINE-11]]
42 // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*stack-origin2.cpp:.* main}}