1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3 
4 
5 #include "mpx-check.h"
6 #include "stdarg.h"
7 
8 int buf[100];
9 int buf1[10];
10 
11 int
rd(int * pppp,int n,...)12 rd (int *pppp, int n, ...)
13 {
14   va_list argp;
15   int *p;
16   int i;
17   int res;
18 
19   va_start (argp, n);
20   for (; n > 0; n--)
21     va_arg (argp, int *);
22   p = va_arg (argp, int *);
23   i = va_arg (argp, int);
24 
25   res = p[i];
26   printf ("%d\n", res);
27 
28   return res;
29 }
30 
mpx_test(int argc,const char ** argv)31 int mpx_test (int argc, const char **argv)
32 {
33   rd (buf1, 1, buf1, buf, 0, buf1);
34   rd (buf1, 1, buf1, buf, 99, buf1);
35   return 0;
36 }
37