Bail out HARD_REGISTER vars in asan (PR sanitizer/81224).
authorMartin Liska <mliska@suse.cz>
Wed, 28 Jun 2017 07:59:23 +0000 (09:59 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Wed, 28 Jun 2017 07:59:23 +0000 (07:59 +0000)
2017-06-28  Martin Liska  <mliska@suse.cz>

PR sanitizer/81224
* asan.c (instrument_derefs): Bail out inner references
that are hard register variables.
2017-06-28  Martin Liska  <mliska@suse.cz>

PR sanitizer/81224
* gcc.dg/asan/pr81224.c: New test.

From-SVN: r249728

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

index ff71efad23eefcca11f66871e129fd7ad4dac1f7..a70b03dd9ed9a7a69123a3fecbfbdf7b20180ad6 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-28  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/81224
+       * asan.c (instrument_derefs): Bail out inner references
+       that are hard register variables.
+
 2017-06-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/81175
index e730530930b44fbf937542ceff2d0f988e9a4b10..3f814819addad58f8d76d8e40dbbf2780738ebea 100644 (file)
@@ -1875,6 +1875,9 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
       || bitsize != size_in_bytes * BITS_PER_UNIT)
     return;
 
+  if (VAR_P (inner) && DECL_HARD_REGISTER (inner))
+    return;
+
   if (VAR_P (inner)
       && offset == NULL_TREE
       && bitpos >= 0
index f2f9a3e1b89f0d28f253dc189c63d766ad2a2822..178b23666a889da5ebc34c9e084cf8a1d4b85e97 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-28  Martin Liska  <mliska@suse.cz>
+
+       PR sanitizer/81224
+       * gcc.dg/asan/pr81224.c: New test.
+
 2017-06-28  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/tree-prof/val-profiler-threads-1.c (main): Fix 2nd argument
diff --git a/gcc/testsuite/gcc.dg/asan/pr81224.c b/gcc/testsuite/gcc.dg/asan/pr81224.c
new file mode 100644 (file)
index 0000000..def5cb6
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR sanitizer/80659 */
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
+/* { dg-additional-options "-msse2" } */
+
+int a;
+int
+b ()
+{
+  register __attribute__ ((__vector_size__ (4 * sizeof (int)))) int c asm("xmm0");
+  return c[a];
+}