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