blob: 30cfb47b66d4a75fcf858e52d3e98ae655dc6f23 [file] [log] [blame]
Evgeniy Stepanov9af86762013-02-11 11:34:26 +00001// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %t >%t.out 2>&1
2// RUN: FileCheck %s < %t.out
3// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %t >%t.out 2>&1
4// RUN: FileCheck %s < %t.out
5// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %t >%t.out 2>&1
6// RUN: FileCheck %s < %t.out
7// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %t >%t.out 2>&1
8// RUN: FileCheck %s < %t.out
9
10// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %t >%t.out 2>&1
11// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
12// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %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 -m64 -O2 %s -o %t && not %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 -m64 -O3 %s -o %t && not %t >%t.out 2>&1
17// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
18
19#include <stdlib.h>
20int main(int argc, char **argv) {
21 int x;
22 int *volatile p = &x;
23 if (*p)
24 exit(0);
Evgeniy Stepanov6ac157d2013-05-28 14:27:30 +000025 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
Evgeniy Stepanov9af86762013-02-11 11:34:26 +000026 // CHECK: {{#0 0x.* in main .*stack-origin.cc:}}[[@LINE-3]]
27
28 // CHECK-ORIGINS: Uninitialized value was created by an allocation of 'x' in the stack frame of function 'main'
29
30 // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*stack-origin.cc:.* main}}
31 return 0;
32}