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 Foo {
11   int buf[10] __attribute__((bnd_variable_size));
12 };
13 
rd(int * p,int i)14 int rd (int *p, int i)
15 {
16   int res = p[i];
17   printf ("%d\n", res);
18   return res;
19 }
20 
mpx_test(int argc,const char ** argv)21 int mpx_test (int argc, const char **argv) {
22   struct Foo *foo = (struct Foo *) alloca (20 * sizeof(int));
23 
24   rd (foo->buf, -1);
25 
26   return 0;
27 }
28