1 /* C99 6.5.2.2 Function calls.
2    Test pointer argument passing and return values involving decimal floating
3    point types.  */
4 
5 #include "dfp-dbg.h"
6 
7 /* A handful of functions that return their Nth pointer to Decimal32
8    argument.  */
9 
10 _Decimal32 *
arg0_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)11 arg0_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
12 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
13 {
14   return arg0;
15 }
16 
17 _Decimal32 *
arg1_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)18 arg1_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
19 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
20 {
21   return arg1;
22 }
23 
24 _Decimal32 *
arg2_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)25 arg2_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
26 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
27 {
28   return arg2;
29 }
30 
31 _Decimal32 *
arg3_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)32 arg3_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
33 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
34 {
35   return arg3;
36 }
37 
38 _Decimal32 *
arg4_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)39 arg4_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
40 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
41 {
42   return arg4;
43 }
44 
45 _Decimal32 *
arg5_32(_Decimal32 * arg0,_Decimal32 * arg1,_Decimal32 * arg2,_Decimal32 * arg3,_Decimal32 * arg4,_Decimal32 * arg5)46 arg5_32 (_Decimal32 *arg0, _Decimal32 *arg1, _Decimal32 *arg2,
47 	 _Decimal32 *arg3, _Decimal32 *arg4, _Decimal32 *arg5)
48 {
49   return arg5;
50 }
51 
52 
53 /* A handful of functions that return their Nth pointer to _Decimal64
54    argument.  */
55 
56 _Decimal64 *
arg0_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)57 arg0_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
58 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
59 {
60   return arg0;
61 }
62 
63 _Decimal64 *
arg1_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)64 arg1_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
65 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
66 {
67   return arg1;
68 }
69 
70 _Decimal64 *
arg2_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)71 arg2_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
72 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
73 {
74   return arg2;
75 }
76 
77 _Decimal64 *
arg3_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)78 arg3_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
79 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
80 {
81   return arg3;
82 }
83 
84 _Decimal64 *
arg4_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)85 arg4_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
86 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
87 {
88   return arg4;
89 }
90 
91 _Decimal64 *
arg5_64(_Decimal64 * arg0,_Decimal64 * arg1,_Decimal64 * arg2,_Decimal64 * arg3,_Decimal64 * arg4,_Decimal64 * arg5)92 arg5_64 (_Decimal64 *arg0, _Decimal64 *arg1, _Decimal64 *arg2,
93 	 _Decimal64 *arg3, _Decimal64 *arg4, _Decimal64 *arg5)
94 {
95   return arg5;
96 }
97 
98 
99 /* A handful of functions that return their Nth _Decimal128
100    argument.  */
101 
102 _Decimal128 *
arg0_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)103 arg0_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
104 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
105 {
106   return arg0;
107 }
108 
109 _Decimal128 *
arg1_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)110 arg1_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
111 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
112 {
113   return arg1;
114 }
115 
116 _Decimal128 *
arg2_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)117 arg2_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
118 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
119 {
120   return arg2;
121 }
122 
123 _Decimal128 *
arg3_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)124 arg3_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
125 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
126 {
127   return arg3;
128 }
129 
130 _Decimal128 *
arg4_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)131 arg4_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
132 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
133 {
134   return arg4;
135 }
136 
137 _Decimal128 *
arg5_128(_Decimal128 * arg0,_Decimal128 * arg1,_Decimal128 * arg2,_Decimal128 * arg3,_Decimal128 * arg4,_Decimal128 * arg5)138 arg5_128 (_Decimal128 *arg0, _Decimal128 *arg1, _Decimal128 *arg2,
139 	  _Decimal128 *arg3, _Decimal128 *arg4, _Decimal128 *arg5)
140 {
141   return arg5;
142 }
143 
144 
145 
146 _Decimal32 df0 = 0.0df, df1 = 1.0df, df2 = 2.0df,
147 	   df3 = 3.0df, df4 = 4.0df, df5 = 5.0df;
148 _Decimal32 *pdf0 = &df0, *pdf1 = &df1, *pdf2 = &df2,
149 	   *pdf3 = &df3, *pdf4 = &df4, *pdf5 = &df5;
150 _Decimal64 dd0 = 0.0dd, dd1 = 1.0dd, dd2 = 2.0dd,
151 	   dd3 = 3.0dd, dd4 = 4.0dd, dd5 = 5.0dd;
152 _Decimal64 *pdd0 = &dd0, *pdd1 = &dd1, *pdd2 = &dd2,
153 	   *pdd3 = &dd3, *pdd4 = &dd4, *pdd5 = &dd5;
154 _Decimal128 dl0 = 0.0dl, dl1 = 1.0dl, dl2 = 2.0dl,
155 	    dl3 = 3.0dl, dl4 = 4.0dl, dl5 = 5.0dl;
156 _Decimal128 *pdl0 = &dl0, *pdl1 = &dl1, *pdl2 = &dl2,
157 	    *pdl3 = &dl3, *pdl4 = &dl4, *pdl5 = &dl5;
158 
159 int
main()160 main ()
161 {
162   /* _Decimal32 variants.  */
163   if (*arg0_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 0.0df)
164     FAILURE
165   if (*arg1_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 1.0df)
166     FAILURE
167   if (*arg2_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 2.0df)
168     FAILURE
169   if (*arg3_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 3.0df)
170     FAILURE
171   if (*arg4_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 4.0df)
172     FAILURE
173   if (*arg5_32 (pdf0, pdf1, pdf2, pdf3, pdf4, pdf5) != 5.0df)
174     FAILURE
175 
176   /* _Decimal64 variants.  */
177   if (*arg0_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 0.0dd)
178     FAILURE
179   if (*arg1_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 1.0dd)
180     FAILURE
181   if (*arg2_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 2.0dd)
182     FAILURE
183   if (*arg3_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 3.0dd)
184     FAILURE
185   if (*arg4_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 4.0dd)
186     FAILURE
187   if (*arg5_64 (pdd0, pdd1, pdd2, pdd3, pdd4, pdd5) != 5.0dd)
188     FAILURE
189 
190   /* _Decimal128 variants.  */
191   if (*arg0_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 0.0dl)
192     FAILURE
193   if (*arg1_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 1.0dl)
194     FAILURE
195   if (*arg2_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 2.0dl)
196     FAILURE
197   if (*arg3_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 3.0dl)
198     FAILURE
199   if (*arg4_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 4.0dl)
200     FAILURE
201   if (*arg5_128 (pdl0, pdl1, pdl2, pdl3, pdl4, pdl5) != 5.0dl)
202     FAILURE
203 
204   FINISH
205 }
206