1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3 
4 
5 #include "mpx-check.h"
6 
7 int *_buf1[100];
8 int _buf2[100];
9 
get_buf1()10 int **get_buf1 ()
11 {
12   return _buf1;
13 }
14 
get_buf2()15 int *get_buf2 ()
16 {
17   return _buf2;
18 }
19 
wr(int i,int ** buf1,int * buf2)20 void wr (int i, int **buf1, int *buf2)
21 {
22   buf1[i] = buf2;
23 }
24 
rd(int i,int j,int ** buf)25 int rd (int i, int j, int **buf)
26 {
27   int res = buf[i][j];
28   printf ("%d\n", res);
29   return res;
30 }
31 
mpx_test(int argc,const char ** argv)32 int mpx_test (int argc, const char **argv)
33 {
34   int **buf1 = get_buf1 ();
35   int *buf2 = get_buf2 ();
36   wr(10, buf1, buf2);
37   rd(10, 0, buf1);
38   rd(10, 99, buf1);
39 
40   return 0;
41 }
42