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