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 {
12   int a;
13   int p[0];
14 };
15 
rd(int * p,int i)16 int rd (int *p, int i)
17 {
18   int res = p[i];
19   printf ("%d\n", res);
20   return res;
21 }
22 
mpx_test(int argc,const char ** argv)23 int mpx_test (int argc, const char **argv)
24 {
25   struct S *s = (struct S *)alloca (sizeof(struct S) + sizeof (int)*100);
26   rd (s->p, 100);
27 
28   return 0;
29 }
30