1 /* { dg-do run } */ 2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */ 3 4 /* { dg-additional-options "-fchkp-narrow-to-innermost-array" } */ 5 6 #include "mpx-check.h" 7 8 struct S { 9 int arr[100]; 10 } S; 11 12 struct S sa[10]; 13 rd(int * p,int i)14int 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)21int mpx_test (int argc, const char **argv) 22 { 23 rd (&sa[argc].arr[0], 0); 24 rd (&sa[argc].arr[0], 99); 25 26 return 0; 27 } 28