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