[compiler-rt] r187971 - [sanitizer] ASan/MSan tests for r187967.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Aug 8 02:23:20 PDT 2013


Author: eugenis
Date: Thu Aug  8 04:23:19 2013
New Revision: 187971

URL: http://llvm.org/viewvc/llvm-project?rev=187971&view=rev
Log:
[sanitizer] ASan/MSan tests for r187967.

r187967: Disable inlining between sanitized and non-sanitized functions.

Added:
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc   (with props)
    compiler-rt/trunk/lib/msan/lit_tests/inline.cc   (with props)

Added: compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc?rev=187971&view=auto
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc (added)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc Thu Aug  8 04:23:19 2013
@@ -0,0 +1,19 @@
+// RUN: %clangxx_asan -O3 %s -o %t && %t
+
+// Test that no_sanitize_address attribute applies even when the function would
+// be normally inlined.
+
+#include <stdlib.h>
+
+__attribute__((no_sanitize_address))
+int f(int *p) {
+  return *p; // BOOOM?? Nope!
+}
+
+int main(int argc, char **argv) {
+  int * volatile x = (int*)malloc(2*sizeof(int) + 2);
+  int res = f(x + 2);
+  if (res)
+    exit(0);
+  return 0;
+}

Propchange: compiler-rt/trunk/lib/asan/lit_tests/TestCases/inline.cc
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: compiler-rt/trunk/lib/msan/lit_tests/inline.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/lit_tests/inline.cc?rev=187971&view=auto
==============================================================================
--- compiler-rt/trunk/lib/msan/lit_tests/inline.cc (added)
+++ compiler-rt/trunk/lib/msan/lit_tests/inline.cc Thu Aug  8 04:23:19 2013
@@ -0,0 +1,20 @@
+// RUN: %clangxx_msan -O3 %s -o %t && %t
+
+// Test that no_sanitize_memory attribute applies even when the function would
+// be normally inlined.
+
+#include <stdlib.h>
+
+__attribute__((no_sanitize_memory))
+int f(int *p) {
+  if (*p) // BOOOM?? Nope!
+    exit(0);
+  return 0;
+}
+
+int main(int argc, char **argv) {
+  int x;
+  int * volatile p = &x;
+  int res = f(p);
+  return 0;
+}

Propchange: compiler-rt/trunk/lib/msan/lit_tests/inline.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list