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