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