1 // Test various levels of coverage
3 // RUN: %clangxx_msan -DINIT_VAR=1 -O1 -fsanitize-coverage=func,trace-pc-guard %s -o %t
4 // RUN: mkdir -p %t-dir
5 // RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
6 // RUN: %clangxx_msan -O1 -fsanitize-coverage=func,trace-pc-guard %s -o %t
7 // RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
8 // RUN: %clangxx_msan -O1 -fsanitize-coverage=bb,trace-pc-guard %s -o %t
9 // RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
10 // RUN: %clangxx_msan -O1 -fsanitize-coverage=edge,trace-pc-guard %s -o %t
11 // RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%t-dir not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
14 int main(int argc
, char **argv
) {
21 return *(volatile int*)&var
;
24 // CHECK_WARN: WARNING: MemorySanitizer: use-of-uninitialized-value
25 // CHECK_NOWARN-NOT: ERROR
26 // CHECK1: 1 PCs written
27 // CHECK2: 1 PCs written
28 // CHECK3: 2 PCs written