[bazel] Add missing dependencies for a0ef12c64284abf59bc092b2535cce1247d5f9a4
[llvm-project.git] / compiler-rt / test / msan / stack-origin.cpp
blobe834c992e860d1ccf542323a208ab42187fb64a7
1 // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
2 // RUN: FileCheck %s < %t.out
3 // RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
4 // RUN: FileCheck %s < %t.out
5 // RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
6 // RUN: FileCheck %s < %t.out
7 // RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
8 // RUN: FileCheck %s < %t.out
10 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
11 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefixes=CHECK-ORIGINS,ORIGINS-FAT < %t.out
12 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
13 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefixes=CHECK-ORIGINS,ORIGINS-FAT < %t.out
14 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
15 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefixes=CHECK-ORIGINS,ORIGINS-FAT < %t.out
16 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
17 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefixes=CHECK-ORIGINS,ORIGINS-FAT < %t.out
19 // RUN: %clangxx_msan -fsanitize-memory-track-origins -mllvm -msan-print-stack-names=0 -O0 %s -o %t && not %run %t >%t.out 2>&1
20 // RUN: FileCheck %s < %t.out && FileCheck %s --check-prefixes=CHECK-ORIGINS,ORIGINS-LEAN < %t.out
22 #include <stdlib.h>
23 int main(int argc, char **argv) {
24 int x;
25 int *volatile p = &x;
26 return *p;
27 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
28 // CHECK: {{#0 0x.* in main .*stack-origin.cpp:}}[[@LINE-2]]
30 // ORIGINS-FAT: Uninitialized value was created by an allocation of 'x' in the stack frame
31 // ORIGINS-LEAN: Uninitialized value was created in the stack frame
32 // CHECK-ORIGINS: {{#0 0x.* in main .*stack-origin.cpp:}}[[@LINE-8]]
34 // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*stack-origin.cpp:.* main}}