Do not handled volatile arguments (PR sanitizer/82484).
authorMartin Liska <mliska@suse.cz>
Thu, 1 Mar 2018 14:54:10 +0000 (15:54 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 1 Mar 2018 14:54:10 +0000 (14:54 +0000)
2018-03-01  Martin Liska  <mliska@suse.cz>

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

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

From-SVN: r258101

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

index 8796943..ff97b4b 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-01  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82484
+       * sanopt.c (sanitize_rewrite_addressable_params): Do not handle
+       volatile arguments.
+
 2018-03-01  Richard Biener  <rguenther@suse.de>
 
        PR debug/84645
index cd94638..4374313 100644 (file)
@@ -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;
index a9e12be..d1acff6 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-01  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/82484
+       * gcc.dg/asan/pr82484.c: New test.
+
 2018-03-01  Richard Biener  <rguenther@suse.de>
 
        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 (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); }