aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/union-2.c
blob: edc8a7abf114b98668ba41a98cb1dd5f1f7e90ea (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
/* This used to segfault on SPARC 64-bit at runtime because
   the stack pointer was clobbered by the function call.   */

/* { dg-do run } */

#include <stdarg.h>

union U
{
  long l1[2];
};

union U u;

void foo (int z, ...)
{
  int i;
  va_list ap;
  va_start(ap,z);
  i = va_arg(ap, int);
  va_end(ap);
}

int main(void)
{
  foo (1, 1, 1, 1, 1, u);
  return 0;
}