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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [struct-layout-1.c] - Blame information for rev 856

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

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99" } */
2
 
3
#include <stdarg.h>
4
 
5
extern void abort (void);
6
 
7
struct S1
8
{
9
  _Decimal64 a[0];
10
};
11
 
12
struct S2
13
{
14
  struct
15
  {
16
    _Decimal64 e;
17
  } b[0];
18
};
19
 
20
struct S3
21
{
22
  union
23
  {
24
    _Decimal64 c;
25
  } a[0];
26
};
27
 
28
struct S4
29
{
30
  int a[0];
31
  _Decimal64 b[0];
32
};
33
 
34
struct S5
35
{
36
  union
37
  {
38
    _Decimal64 c[0];
39
  } a;
40
};
41
 
42
static int failcnt = 0;
43
 
44
/* Support compiling the test to report individual failures; default is
45
   to abort as soon as a check fails.  */
46
#ifdef DBG
47
#include <stdio.h>
48
#define FAILURE do                             \
49
{ printf ("failed at line %d\n", __LINE__);    \
50
  failcnt++;                                   \
51
}while(0)
52
#else
53
#define FAILURE abort ()
54
#endif
55
 
56
int check_var (int z, ...)
57
{
58
  long long result;
59
  va_list ap;
60
  va_start (ap, z);
61
  va_arg (ap, struct S1);
62
  result = va_arg (ap, long long);
63
  va_end (ap);
64
 
65
  return (result == 2LL);
66
}
67
 
68
int main ()
69
{
70
  struct S1 s1;
71
  struct S2 s2;
72
  struct S3 s3;
73
  struct S4 s4;
74
  struct S5 s5;
75
 
76
  if (check_var (2, s1, 2LL) == 0)
77
    FAILURE;
78
  if (check_var (2, s2, 2LL) == 0)
79
    FAILURE;
80
  if (check_var (2, s3, 2LL) == 0)
81
    FAILURE;
82
  if (check_var (2, s4, 2LL) == 0)
83
    FAILURE;
84
  if (check_var (2, s5, 2LL) == 0)
85
    FAILURE;
86
 
87
  if (failcnt)
88
    abort ();
89
 
90
  return 0;
91
}

powered by: WebSVN 2.1.0

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