comparison gcc/testsuite/c-c++-common/asan/bitfield-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Check that Asan correctly instruments bitfields with round offset. */
2
3 /* { dg-do run } */
4 /* { dg-shouldfail "asan" } */
5
6 struct A
7 {
8 char base;
9 int : 8;
10 int x : 8;
11 };
12
13 int __attribute__ ((noinline, noclone))
14 f (void *p) {
15 return ((struct A *)p)->x;
16 }
17
18 int
19 main ()
20 {
21 char a = 0;
22 return f (&a);
23 }
24
25 /* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */