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