1 /* Check that Asan correctly instruments bitfields with non-round offset. */ 2 3 /* { dg-do run } */ 4 /* { dg-shouldfail "asan" } */ 5 6 struct A 7 { 8 char base; 9 int : 7; 10 int x : 8; 11 }; 12 13 int __attribute__ ((noinline, noclone)) f(void * p)14f (void *p) { 15 return ((struct A *)p)->x; 16 } 17 18 int main()19main () 20 { 21 char a = 0; 22 return f (&a); 23 } 24 25 /* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ 26