asan.c (instrument_derefs): BIT_FIELD_REF added.

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
This commit is contained in:
Marat Zakirov 2014-10-13 10:44:45 +00:00 committed by Marat Zakirov
parent 2f6ca9d317
commit 913f32a121
4 changed files with 33 additions and 0 deletions

View 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

View 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:

View 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

View File

@ -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" } */