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/] [func-struct.c] - Blame information for rev 867

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
/* C99 6.5.2.2 Function calls.
4
   Test structure passing and return values involving decimal floating
5
   point types.  */
6
 
7
extern void abort (void);
8
 
9
struct example
10
{
11
  _Decimal128 d128;
12
  char dummy1;
13
  _Decimal64 d64;
14
  char dummy2;
15
  _Decimal32 d32;
16
} nums = { 1.0dl, 'a', 2.0dd, 'b', 3.0df };
17
 
18
_Decimal32
19
d32_field (struct example s)
20
{
21
  return s.d32;
22
}
23
 
24
_Decimal64
25
d64_field (struct example s)
26
{
27
  return s.d64;
28
}
29
 
30
_Decimal128
31
d128_field (struct example s)
32
{
33
  return s.d128;
34
}
35
 
36
char
37
dummy1_field (struct example s)
38
{
39
  return s.dummy1;
40
}
41
 
42
char
43
dummy2_field (struct example s)
44
{
45
  return s.dummy2;
46
}
47
 
48
_Decimal32
49
ptr_d32_field (struct example *s)
50
{
51
  return s->d32;
52
}
53
 
54
_Decimal64
55
ptr_d64_field (struct example *s)
56
{
57
  return s->d64;
58
}
59
 
60
_Decimal128
61
ptr_d128_field (struct example *s)
62
{
63
  return s->d128;
64
}
65
 
66
char
67
ptr_dummy1_field (struct example *s)
68
{
69
  return s->dummy1;
70
}
71
 
72
char
73
ptr_dummy2_field (struct example *s)
74
{
75
  return s->dummy2;
76
}
77
 
78
 
79
int
80
main ()
81
{
82
  if (d32_field (nums) != 3.0df) abort ();
83
  if (d64_field (nums) != 2.0dd) abort ();
84
  if (d128_field (nums) != 1.0dl) abort ();
85
  if (dummy1_field (nums) != 'a') abort ();
86
  if (dummy2_field (nums) != 'b') abort ();
87
 
88
  if (ptr_d32_field (&nums) != 3.0df) abort ();
89
  if (ptr_d64_field (&nums) != 2.0dd) abort ();
90
  if (ptr_d128_field (&nums) != 1.0dl) abort ();
91
  if (ptr_dummy1_field (&nums) != 'a') abort ();
92
  if (ptr_dummy2_field (&nums) != 'b') abort ();
93
 
94
  return 0;
95
}

powered by: WebSVN 2.1.0

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