OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20020412-1.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* PR c/3711
2
   This testcase ICEd on IA-32 at -O0 and was miscompiled otherwise,
3
   because std_expand_builtin_va_arg didn't handle variable size types.  */
4
 
5
#include <stdarg.h>
6
 
7
extern void abort (void);
8
extern void exit (int);
9
 
10
void bar (int c)
11
{
12
  static int d = '0';
13
 
14
  if (c != d++)
15
    abort ();
16
  if (c < '0' || c > '9')
17
    abort ();
18
}
19
 
20
void foo (int size, ...)
21
{
22
  struct
23
  {
24
    char x[size];
25
  } d;
26
  va_list ap;
27
  int i;
28
 
29
  va_start (ap, size);
30
  d = va_arg (ap, typeof (d));
31
  for (i = 0; i < size; i++)
32
    bar (d.x[i]);
33
  d = va_arg (ap, typeof (d));
34
  for (i = 0; i < size; i++)
35
    bar (d.x[i]);
36
  va_end (ap);
37
}
38
 
39
int main (void)
40
{
41
  int z = 5;
42
  struct { char a[z]; } x, y;
43
 
44
  x.a[0] = '0';
45
  x.a[1] = '1';
46
  x.a[2] = '2';
47
  x.a[3] = '3';
48
  x.a[4] = '4';
49
  y.a[0] = '5';
50
  y.a[1] = '6';
51
  y.a[2] = '7';
52
  y.a[3] = '8';
53
  y.a[4] = '9';
54
  foo (z, x, y);
55
  exit (0);
56
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.