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[100]; 13 int c; 14 } S; 15 foo(int * p,int i)16int foo (int *p, int i) 17 { 18 printf ("%d\n", p[i]); 19 return p[i]; 20 } 21 22 struct S s; 23 mpx_test(int argc,const char ** argv)24int mpx_test (int argc, const char **argv) 25 { 26 foo (&s.b[0], -1); 27 28 return 0; 29 } 30