From: Martin Liska Date: Wed, 11 Oct 2017 12:24:44 +0000 (+0200) Subject: Do not handled volatile arguments (PR sanitizer/82484). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78188a05d0f423b99edee82bce01fdad35e3c37b;p=gcc.git Do not handled volatile arguments (PR sanitizer/82484). 2017-10-11 Martin Liska PR sanitizer/82484 * sanopt.c (sanitize_rewrite_addressable_params): Do not handle volatile arguments. 2017-10-11 Martin Liska PR sanitizer/82484 * gcc.dg/asan/pr82484.c: New test. From-SVN: r253637 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 507859b0fcd..6b02c6216bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-11 Martin Liska + + PR sanitizer/82484 + * sanopt.c (sanitize_rewrite_addressable_params): Do not handle + volatile arguments. + 2017-10-11 Adhemerval Zanella * config.gcc (default_gnu_indirect_function): Default to yes for diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 997bcfd3df7..019cf9fa81c 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -1140,7 +1140,9 @@ sanitize_rewrite_addressable_params (function *fun) arg; arg = DECL_CHAIN (arg)) { tree type = TREE_TYPE (arg); - if (TREE_ADDRESSABLE (arg) && !TREE_ADDRESSABLE (type) + if (TREE_ADDRESSABLE (arg) + && !TREE_ADDRESSABLE (type) + && !TREE_THIS_VOLATILE (arg) && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST) { TREE_ADDRESSABLE (arg) = 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b60350710d..b6093d079ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-11 Martin Liska + + PR sanitizer/82484 + * gcc.dg/asan/pr82484.c: New test. + 2017-10-11 Martin Liska * c-c++-common/ubsan/ptr-overflow-sanitization-1.c: Scan diff --git a/gcc/testsuite/gcc.dg/asan/pr82484.c b/gcc/testsuite/gcc.dg/asan/pr82484.c new file mode 100644 index 00000000000..f8051bd300c --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr82484.c @@ -0,0 +1,5 @@ +/* PR sanitizer/82484 */ +/* { dg-do compile } */ + +void foo(volatile int *ptr); +void a (volatile int b) { foo(&b); }