1 /* { dg-do run } */ 2 /* { dg-shouldfail "bounds violation" } */ 3 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */ 4 5 6 #define SHOULDFAIL 7 8 #include "mpx-check.h" 9 10 struct s { 11 int a; 12 int b : 10; 13 int c : 1; 14 int e : 10; 15 } s; 16 17 #define HH (unsigned char)1 18 foo(struct s * p)19int foo (struct s *p) 20 { 21 int val = p->b; 22 printf ("%d\n", val); 23 return val == HH; 24 } 25 mpx_test(int argc,const char ** argv)26int mpx_test (int argc, const char **argv) 27 { 28 struct s buf[100]; 29 30 foo (buf - 1); 31 32 return 0; 33 } 34