aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/asan/bitfield-5.c
blob: eb5e9e9fe07ac98b4feb376db3791284f4b8fd60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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" } */