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