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