summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/mpx/vararg-8-nov.c
blob: 59596f2716633d591403b3f1912956a5e7dfec53 (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
37
38
/* { dg-do run } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */


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

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

void vararg (int *p, va_list al)
{
  int i;
  int res;

  p = va_arg (al, int *);
  i = va_arg (al, int);

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

void foo (int *p, ...)
{
  va_list args;

  va_start (args, p);
  vararg (p, args);
  va_end (args);
}

int mpx_test (int argc, const char **argv)
{
  foo (buf1, buf, 0);
  foo (buf1, buf, 99);

  return 0;
}