From: Martin Liska Date: Mon, 27 Aug 2018 13:21:28 +0000 (+0200) Subject: Sanopt: ignore params with DECL_HAS_VALUE_EXPR_P (PR sanitizer/86962). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47c3496bf898e9dfe12799ef6e31ae9b9211c63d;p=gcc.git Sanopt: ignore params with DECL_HAS_VALUE_EXPR_P (PR sanitizer/86962). 2018-08-27 Martin Liska PR sanitizer/86962 * sanopt.c (sanitize_rewrite_addressable_params): Ignore params with DECL_HAS_VALUE_EXPR_P. 2018-08-27 Martin Liska PR sanitizer/86962 * gcc.dg/asan/pr86962.c: New test. From-SVN: r263882 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c79e41f2db..6a047129086 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-27 Martin Liska + + PR sanitizer/86962 + * sanopt.c (sanitize_rewrite_addressable_params): Ignore + params with DECL_HAS_VALUE_EXPR_P. + 2018-08-27 Martin Liska * config/i386/i386.c (ix86_expand_set_or_movmem): Dump diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 223c06a8355..082f936adb5 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -1165,13 +1165,15 @@ sanitize_rewrite_addressable_params (function *fun) gimple_add_tmp_var (var); + /* We skip parameters that have a DECL_VALUE_EXPR. */ + if (DECL_HAS_VALUE_EXPR_P (arg)) + continue; + if (dump_file) fprintf (dump_file, "Rewriting parameter whose address is taken: %s\n", IDENTIFIER_POINTER (DECL_NAME (arg))); - gcc_assert (!DECL_HAS_VALUE_EXPR_P (arg)); - SET_DECL_PT_UID (var, DECL_PT_UID (arg)); /* Assign value of parameter to newly created variable. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6e6ffd84ff2..4f49ffd055a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-27 Martin Liska + + PR sanitizer/86962 + * gcc.dg/asan/pr86962.c: New test. + 2018-08-27 Martin Liska * gcc.dg/tree-prof/val-prof-10.c: New test. diff --git a/gcc/testsuite/gcc.dg/asan/pr86962.c b/gcc/testsuite/gcc.dg/asan/pr86962.c new file mode 100644 index 00000000000..7a8cfa98f0e --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr86962.c @@ -0,0 +1,13 @@ +/* PR sanitizer/86962 */ +/* { dg-do compile } */ + +extern int dummy (int *); + +void foo(int i) +{ + int j=i; + + void bar() { int x=j, y=i; } + + dummy(&i); +}