From 99daa7a9eeffa553d3fd3b8dcf6dd721441921c6 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 1 Mar 2018 15:54:10 +0100 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/sanopt.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asan/pr82484.c | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/asan/pr82484.c 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); } -- 2.30.2