Files
clang-p2996/compiler-rt/test/msan/no_sanitize_memory_prop.cpp
Vitaly Buka 15805c030f [tests][msan] Use -fno-sanitize-memory-param-retval in tests
Supports either default of -f[no-]sanitize-memory-param-retval.

Reviewed By: aeubanks, MaskRay

Differential Revision: https://reviews.llvm.org/D134683
2022-09-26 17:24:22 -07:00

26 lines
701 B
C++

// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O0 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O1 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O2 %s -o %t && %run %t >%t.out 2>&1
// RUN: %clangxx_msan -fno-sanitize-memory-param-retval -O3 %s -o %t && %run %t >%t.out 2>&1
// Test that (no_sanitize_memory) functions DO NOT propagate shadow.
#include <stdlib.h>
#include <stdio.h>
__attribute__((noinline))
__attribute__((weak))
__attribute__((no_sanitize_memory))
int f(int x) {
return x;
}
int main(void) {
int x;
int * volatile p = &x;
int y = f(*p);
if (y)
exit(0);
return 0;
}