[asan] added a test for a bug in asan at -O0 introduced by r165936 (making asan a...
authorKostya Serebryany <kcc@google.com>
Wed, 17 Oct 2012 13:42:04 +0000 (13:42 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 17 Oct 2012 13:42:04 +0000 (13:42 +0000)
llvm-svn: 166103

compiler-rt/lib/asan/lit_tests/force_inline_opt0.cc [new file with mode: 0644]

diff --git a/compiler-rt/lib/asan/lit_tests/force_inline_opt0.cc b/compiler-rt/lib/asan/lit_tests/force_inline_opt0.cc
new file mode 100644 (file)
index 0000000..b9eeabc
--- /dev/null
@@ -0,0 +1,14 @@
+// This test checks that we are no instrumenting a memory access twice
+// (before and after inlining)
+// RUN: %clangxx_asan -m64 -O1 %s -o %t && %t
+// FIXME (enable this line): %clangxx_asan -m64 -O0 %s -o %t && %t
+__attribute__((always_inline))
+void foo(int *x) {
+  *x = 0;
+}
+
+int main() {
+  int x;
+  foo(&x);
+  return x;
+}