Hello.
Following patch fixed race where we first need to properly build
all gimple_build_debug_bind (arg, var, NULL) and then DECL_HAS_VALUE_EXPR_P
can be registered.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Ready to be installed?
Martin
gcc/ChangeLog:
2017-07-10 Martin Liska <[email protected]>
PR sanitizer/81340
* sanopt.c (sanitize_rewrite_addressable_params):
gcc/testsuite/ChangeLog:
2017-07-10 Martin Liska <[email protected]>
PR sanitizer/81340
* g++.dg/asan/pr81340.C: New test.
---
gcc/sanopt.c | 5 +++--
gcc/testsuite/g++.dg/asan/pr81340.C | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/asan/pr81340.C
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index b7740741d43..227f72fcdd9 100644
--- a/gcc/sanopt.c
+++ b/gcc/sanopt.c
@@ -915,8 +915,6 @@ sanitize_rewrite_addressable_params (function *fun)
IDENTIFIER_POINTER (DECL_NAME (arg)));
gcc_assert (!DECL_HAS_VALUE_EXPR_P (arg));
- DECL_HAS_VALUE_EXPR_P (arg) = 1;
- SET_DECL_VALUE_EXPR (arg, var);
SET_DECL_PT_UID (var, DECL_PT_UID (arg));
@@ -945,6 +943,9 @@ sanitize_rewrite_addressable_params (function *fun)
gimple_seq_add_stmt (&stmts, g);
clear_value_expr_list.safe_push (arg);
}
+
+ DECL_HAS_VALUE_EXPR_P (arg) = 1;
+ SET_DECL_VALUE_EXPR (arg, var);
}
}
diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C
new file mode 100644
index 00000000000..76ac08a9a56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/pr81340.C
@@ -0,0 +1,22 @@
+// { dg-options "-fsanitize=address -O2 -g -Wno-write-strings" }
+
+class a {
+ struct b {
+ b(int, int);
+ } c;
+
+public:
+ int d;
+ a(char *) : c(0, d) {}
+};
+class e {
+ int f(const int &, const int &, const int &, bool, bool, bool, int, bool);
+};
+class g {
+public:
+ static g *h();
+ void i(a, void *);
+};
+int e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) {
+ g::h()->i("", &j);
+}