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 * pp,...)14 int rd (int *pp, ...)
15 {
16 va_list argp;
17 int *p;
18 int i;
19 int res;
20 int n = 4;
21
22 va_start (argp, pp);
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, buf1, buf1, buf1, buf1, buf, 100, buf1);
37 return 0;
38 }
39