From: Martin Liska Date: Fri, 28 Jul 2017 11:56:47 +0000 (+0200) Subject: Set DECL_VALUE_EXPR after a debug stmt is generated (PR sanitizer/81340). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d7649f8b71f9a16b5e9de0b3f8826c5039fa069;p=gcc.git Set DECL_VALUE_EXPR after a debug stmt is generated (PR sanitizer/81340). 2017-07-28 Martin Liska PR sanitizer/81340 * sanopt.c (sanitize_rewrite_addressable_params): Set VALUE_EXPR after gimple_build_debug_bind. 2017-07-28 Martin Liska PR sanitizer/81340 * g++.dg/asan/pr81340.C: New test. From-SVN: r250660 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 964fa1cdc9c..5aaf5856701 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-28 Martin Liska + + PR sanitizer/81340 + * sanopt.c (sanitize_rewrite_addressable_params): Set VALUE_EXPR after + gimple_build_debug_bind. + 2017-07-28 Richard Biener PR tree-optimization/81502 diff --git a/gcc/sanopt.c b/gcc/sanopt.c index b845f2fab31..f6dd14da00d 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -916,8 +916,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)); @@ -946,6 +944,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/ChangeLog b/gcc/testsuite/ChangeLog index 396f0b1fa98..b82e9bdd9be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-28 Martin Liska + + PR sanitizer/81340 + * g++.dg/asan/pr81340.C: New test. + 2017-07-28 Richard Biener PR tree-optimization/81502 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); +}