asan.c (instrument_derefs): BIT_FIELD_REF added.
authorMarat Zakirov <m.zakirov@samsung.com>
Mon, 13 Oct 2014 10:44:45 +0000 (10:44 +0000)
committerMarat Zakirov <mzakirov@gcc.gnu.org>
Mon, 13 Oct 2014 10:44:45 +0000 (10:44 +0000)
gcc/ChangeLog:

2014-09-19  Marat Zakirov  <m.zakirov@samsung.com>

* asan.c (instrument_derefs): BIT_FIELD_REF added.

gcc/testsuite/ChangeLog:

2014-09-19  Marat Zakirov  <m.zakirov@samsung.com>

* c-c++-common/asan/bitfield-5.c: New test.

From-SVN: r216144

gcc/ChangeLog
gcc/asan.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/asan/bitfield-5.c [new file with mode: 0644]

index a8359339684339cf780f06fbb5328e6eb24c2fa2..667da04f2bde46faa6f6fb92aa933d1eadaef1d1 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-13  Marat Zakirov  <m.zakirov@samsung.com>
+
+       * asan.c (instrument_derefs): BIT_FIELD_REF added.
+
 2014-10-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63419
index ba933c0a5e847606492e6fecdf9c6f244ad05031..2a61a8243d31c86545c560d7ecd9ef3255fd1fe8 100644 (file)
@@ -1711,6 +1711,7 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
     case INDIRECT_REF:
     case MEM_REF:
     case VAR_DECL:
+    case BIT_FIELD_REF:
       break;
       /* FALLTHRU */
     default:
index 1ab2f218049f1abfdf36d332ef3adf76c3d6b2df..2134ada323d4cb1a92a9dd7d489e6cf2a9145a31 100644 (file)
@@ -1,3 +1,7 @@
+2014-09-19  Marat Zakirov  <m.zakirov@samsung.com>
+
+       * c-c++-common/asan/bitfield-5.c: New test.
+
 2014-10-13  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/63419
diff --git a/gcc/testsuite/c-c++-common/asan/bitfield-5.c b/gcc/testsuite/c-c++-common/asan/bitfield-5.c
new file mode 100644 (file)
index 0000000..eb5e9e9
--- /dev/null
@@ -0,0 +1,24 @@
+/* Check BIT_FIELD_REF.  */
+
+/* { dg-do run } */
+/* { dg-shouldfail "asan" } */
+
+struct A
+{
+  int y : 20;
+  int x : 13;
+};
+
+int __attribute__ ((noinline, noclone))
+f (void *p) {
+  return ((struct A *)p)->x != 0;
+}
+
+int
+main ()
+{
+  int a = 0;
+  return f (&a);
+}
+
+/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */