summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/vararg-5-nov.c
blob: bd15e0fde6fa1d50e3d63238dff08c987b25001e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* { dg-do run } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */


#include "mpx-check.h"
#include "stdarg.h"

int buf[100];
int buf1[10];

int
rd (int *pppp, int n, ...)
{
  va_list argp;
  int *p;
  int i;
  int res;

  va_start (argp, n);
  for (; n > 0; n--)
    va_arg (argp, int *);
  p = va_arg (argp, int *);
  i = va_arg (argp, int);

  res = p[i];
  printf ("%d\n", res);

  return res;
}

int mpx_test (int argc, const char **argv)
{
  rd (buf1, 4, buf1, buf1, buf1, buf1, buf, 0, buf1);
  rd (buf1, 4, buf1, buf1, buf1, buf1, buf, 99, buf1);
  return 0;
}