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