diff gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/c-c++-common/asan/force-inline-opt0-1.c	Fri Oct 27 22:46:09 2017 +0900
@@ -0,0 +1,17 @@
+/* This test checks that we are no instrumenting a memory access twice
+   (before and after inlining) */
+
+/* { dg-do compile } */
+/* { dg-options "-fno-sanitize-address-use-after-scope" } */
+/* { dg-final { scan-assembler-not "__asan_report_load" } } */
+
+__attribute__((always_inline))
+inline void foo(int *x) {
+  *x = 0;
+}
+
+int main() {
+  int x;
+  foo(&x);
+  return x;
+}