1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3 
4 
5 #include "mpx-check.h"
6 
7 int buf[100];
8 
9 int __attribute((nothrow))
rd(int * & p,int i)10 rd (int *&p, int i)
11 {
12   int res = p[i];
13   printf ("%d\n", res);
14   return res;
15 }
16 
set_p(int * & ref)17 void set_p (int *&ref)
18 {
19   ref = buf;
20 }
21 
mpx_test(int argc,const char ** argv)22 int mpx_test (int argc, const char **argv)
23 {
24   int *p;
25 
26   set_p (p);
27   rd (p, 0);
28   rd (p, 99);
29 
30   return 0;
31 }
32