summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/va-arg-14.c
blob: d8b517a423b5d1a3e31fa8f87816c5a305d41960 (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
39
40
41
42
43
44
45
#include <stdarg.h>

va_list global;

void vat(va_list param, ...)
{
  va_list local;

  va_start (local, param);
  va_copy (global, local);
  va_copy (param, local);
  if (va_arg (local, int) != 1)
    abort();
  va_end (local);
  if (va_arg (global, int) != 1)
    abort();
  va_end (global);
  if (va_arg (param, int) != 1)
    abort();
  va_end (param);

  va_start (param, param);
  va_start (global, param);
  va_copy (local, param);
  if (va_arg (local, int) != 1)
    abort();
  va_end (local);
  va_copy (local, global);
  if (va_arg (local, int) != 1)
    abort();
  va_end (local);
  if (va_arg (global, int) != 1)
    abort();
  va_end (global);
  if (va_arg (param, int) != 1)
    abort();
  va_end (param);
}

int main(void) 
{
  va_list t;
  vat (t, 1);
  exit (0);
}