1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3
4
5 #include "mpx-check.h"
6
7 struct s1
8 {
9 int *p;
10 int i1;
11 int i2;
12 } s1;
13
rd(int * p1,int * p2,int * p3,int * p4,int * p5,struct s1 s)14 int rd (int *p1, int *p2, int *p3, int *p4, int *p5, struct s1 s)
15 {
16 int res = s.p[s.i1 + s.i2];
17 printf ("%d\n", res);
18 return res;
19 }
20
21 int buf[100];
22 int buf1[10];
23
mpx_test(int argc,const char ** argv)24 int mpx_test (int argc, const char **argv)
25 {
26 struct s1 s;
27 s.p = buf;
28 s.i1 = 50;
29 s.i2 = -50;
30
31 rd (buf1, buf1, buf1, buf1, buf1, s);
32
33 s.i1 = 50;
34 s.i2 = 49;
35
36 rd (buf1, buf1, buf1, buf1, buf1, s);
37
38 return 0;
39 }
40