summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/lto/20090706-1_0.c
blob: 7877fd350d7da3a222e4406a7de9a82970af0409 (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
#include <stdarg.h>

extern void abort (void);

void foo (int size, ...)
{
  struct
    {
      struct
	{
	  char x[size];
	} e;
      unsigned r;
    } d;
  va_list ap;
  char c;
  int i;

  va_start (ap, size);
  d = va_arg (ap, typeof (d));
  c = d.e.x[3];
  if (c != '3')
    abort ();
  if (d.r != 2602)
    abort ();
  va_end (ap);
}

int main (void)
{
  int z = 5, i;
  struct { struct { char a[z]; } y; unsigned r; } x;
          
  x.y.a[0] = '0';
  x.y.a[1] = '1';
  x.y.a[2] = '2';
  x.y.a[3] = '3';
  x.y.a[4] = '4';
  x.r = 2602;
  foo (z, x);
  return 0;
}