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