Files
clang-p2996/compiler-rt/test/msan/no_sanitize_memory.cc
Alexey Samsonov d06aa3dc00 [MSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230999
2015-03-02 19:34:27 +00:00

35 lines
963 B
C++

// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O1 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O2 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O3 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O0 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O1 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O2 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -O3 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
// Test that (no_sanitize_memory) functions
// * don't check shadow values (-DCHECK_IN_F)
// * treat all values loaded from memory as fully initialized (-UCHECK_IN_F)
#include <stdlib.h>
#include <stdio.h>
__attribute__((noinline))
__attribute__((no_sanitize_memory))
int f(void) {
int x;
int * volatile p = &x;
#ifdef CHECK_IN_F
if (*p)
exit(0);
#endif
return *p;
}
int main(void) {
if (f())
exit(0);
return 0;
}