1 /* { dg-do run } */ 2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */ 3 4 5 #include "mpx-check.h" 6 7 struct Foo { 8 int buf[10] __attribute__((bnd_variable_size)); 9 }; 10 rd(int * p,int i)11int rd (int *p, int i) 12 { 13 int res = p[i]; 14 printf ("%d\n", res); 15 return res; 16 } 17 mpx_test(int argc,const char ** argv)18int mpx_test (int argc, const char **argv) { 19 struct Foo *foo = (struct Foo *) alloca (20 * sizeof(int)); 20 21 rd (foo->buf, 0); 22 rd (foo->buf, 19); 23 24 return 0; 25 } 26