From: Martin Liska Date: Thu, 1 Mar 2018 14:54:10 +0000 (+0100) Subject: Do not handled volatile arguments (PR sanitizer/82484). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99daa7a9eeffa553d3fd3b8dcf6dd721441921c6;p=gcc.git Do not handled volatile arguments (PR sanitizer/82484). 2018-03-01 Martin Liska PR sanitizer/82484 * sanopt.c (sanitize_rewrite_addressable_params): Do not handle volatile arguments. 2018-03-01 Martin Liska PR sanitizer/82484 * gcc.dg/asan/pr82484.c: New test. From-SVN: r258101 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87969433118..ff97b4bb606 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-01 Martin Liska + + PR sanitizer/82484 + * sanopt.c (sanitize_rewrite_addressable_params): Do not handle + volatile arguments. + 2018-03-01 Richard Biener PR debug/84645 diff --git a/gcc/sanopt.c b/gcc/sanopt.c index cd94638c869..43743130a35 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -1143,7 +1143,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 a9e12bef2b4..d1acff64fb9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-01 Martin Liska + + PR sanitizer/82484 + * gcc.dg/asan/pr82484.c: New test. + 2018-03-01 Richard Biener PR debug/84645 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); }