Do not handled volatile arguments (PR sanitizer/82484).
authorMartin Liska <mliska@suse.cz>
Wed, 11 Oct 2017 12:24:44 +0000 (14:24 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 11 Oct 2017 12:24:44 +0000 (12:24 +0000)
2017-10-11  Martin Liska  <mliska@suse.cz>

PR sanitizer/82484
* sanopt.c (sanitize_rewrite_addressable_params): Do not handle
volatile arguments.
2017-10-11  Martin Liska  <mliska@suse.cz>

PR sanitizer/82484
* gcc.dg/asan/pr82484.c: New test.

From-SVN: r253637

gcc/ChangeLog
gcc/sanopt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asan/pr82484.c [new file with mode: 0644]

index 507859b0fcd871c36f77c9ee860c926dad2ed6cd..6b02c6216bb0842f317b921ca4f82013afc3d8cb 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-11  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82484
+       * sanopt.c (sanitize_rewrite_addressable_params): Do not handle
+       volatile arguments.
+
 2017-10-11  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        * config.gcc (default_gnu_indirect_function): Default to yes for
index 997bcfd3df71fc058524e5456caac1314066afea..019cf9fa81c0a4b37562d5139aac0cb9868fb24c 100644 (file)
@@ -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;
index 8b60350710d18ba36eff91e997c1b1dd37735ab9..b6093d079ea0c613ca2364815fca7ee26efc75e0 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-11  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82484
+       * gcc.dg/asan/pr82484.c: New test.
+
 2017-10-11  Martin Liska  <mliska@suse.cz>
 
        * 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 (file)
index 0000000..f8051bd
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR sanitizer/82484 */
+/* { dg-do compile } */
+
+void foo(volatile int *ptr);
+void a (volatile int b) { foo(&b); }