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 
rd(int * pppp,int n,...)11 int rd (int *pppp, int n, ...)
12 {
13   va_list argp;
14   int *p;
15   int i;
16   int res;
17 
18   va_start (argp, n);
19   for (; n > 0; n--)
20     va_arg (argp, int *);
21   p = va_arg (argp, int *);
22   i = va_arg (argp, int);
23 
24   res = p[i];
25   printf ("%d\n", res);
26 
27   return res;
28 }
29 
mpx_test(int argc,const char ** argv)30 int mpx_test (int argc, const char **argv)
31 {
32   rd (buf1, 0, buf, 0);
33   rd (buf1, 0, buf, 99);
34   return 0;
35 }
36