summaryrefslogtreecommitdiff
path: root/test/asan/TestCases/force_inline_opt0.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/force_inline_opt0.cc')
-rw-r--r--test/asan/TestCases/force_inline_opt0.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/asan/TestCases/force_inline_opt0.cc b/test/asan/TestCases/force_inline_opt0.cc
new file mode 100644
index 000000000000..e6e5d26c7998
--- /dev/null
+++ b/test/asan/TestCases/force_inline_opt0.cc
@@ -0,0 +1,14 @@
+// This test checks that we are no instrumenting a memory access twice
+// (before and after inlining)
+// RUN: %clangxx_asan -O1 %s -o %t && %run %t
+// RUN: %clangxx_asan -O0 %s -o %t && %run %t
+__attribute__((always_inline))
+void foo(int *x) {
+ *x = 0;
+}
+
+int main() {
+ int x;
+ foo(&x);
+ return x;
+}