]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/i386/mpx/va-arg-pack-1-nov.c
4beda02b9515746b612ef81d8ed163450d23a07f
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / i386 / mpx / va-arg-pack-1-nov.c
1 /* { dg-do run } */
2 /* { dg-options "-fcheck-pointer-bounds -mmpx" } */
3
4 /* { dg-additional-options "-Wno-attributes" } */
5
6 #include "mpx-check.h"
7 #include <stdarg.h>
8
9 int
10 foo2 (int i1, int *p1, ...)
11 {
12 va_list argp;
13 int i;
14 int res;
15
16 va_start(argp, p1);
17 i = va_arg(argp, int);
18
19 res = p1[i + i1];
20 printf("%d\n", res);
21
22 return res;
23 }
24
25 static __attribute__((always_inline)) int
26 foo1 (int *p1, ...)
27 {
28 return foo2 (10, p1, __builtin_va_arg_pack ());
29 }
30
31 int prebuf[100];
32 int buf[100];
33 int postbuf[100];
34
35 int mpx_test (int argc, const char **argv)
36 {
37 foo1 (buf, 89);
38 foo1 (buf, -9);
39 return 0;
40 }