* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / dfp / func-deref.c
blob81a48a9f8e8b403914a1a9a34206388457ce8867
1 /* C99 6.5.2.2 Function calls.
2 Test scalar passing and return values involving decimal floating
3 point types and dereferenced pointers. */
5 #include "dfp-dbg.h"
7 /* A handful of functions that return their Nth _Decimal32
8 argument. */
10 _Decimal32 __attribute__((noinline))
11 arg0_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
12 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
14 return arg0;
17 _Decimal32 __attribute__((noinline))
18 arg1_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
19 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
21 return arg1;
24 _Decimal32 __attribute__((noinline))
25 arg2_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
26 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
28 return arg2;
31 _Decimal32 __attribute__((noinline))
32 arg3_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
33 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
35 return arg3;
38 _Decimal32 __attribute__((noinline))
39 arg4_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
40 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
42 return arg4;
45 _Decimal32 __attribute__((noinline))
46 arg5_32 (_Decimal32 arg0, _Decimal32 arg1, _Decimal32 arg2,
47 _Decimal32 arg3, _Decimal32 arg4, _Decimal32 arg5)
49 return arg5;
53 /* A handful of functions that return their Nth _Decimal64
54 argument. */
56 _Decimal64 __attribute__((noinline))
57 arg0_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
58 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
60 return arg0;
63 _Decimal64 __attribute__((noinline))
64 arg1_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
65 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
67 return arg1;
70 _Decimal64 __attribute__((noinline))
71 arg2_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
72 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
74 return arg2;
77 _Decimal64 __attribute__((noinline))
78 arg3_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
79 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
81 return arg3;
84 _Decimal64 __attribute__((noinline))
85 arg4_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
86 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
88 return arg4;
91 _Decimal64 __attribute__((noinline))
92 arg5_64 (_Decimal64 arg0, _Decimal64 arg1, _Decimal64 arg2,
93 _Decimal64 arg3, _Decimal64 arg4, _Decimal64 arg5)
95 return arg5;
99 /* A handful of functions that return their Nth _Decimal128
100 argument. */
102 _Decimal128 __attribute__((noinline))
103 arg0_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
104 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
106 return arg0;
109 _Decimal128 __attribute__((noinline))
110 arg1_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
111 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
113 return arg1;
116 _Decimal128 __attribute__((noinline))
117 arg2_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
118 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
120 return arg2;
123 _Decimal128 __attribute__((noinline))
124 arg3_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
125 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
127 return arg3;
130 _Decimal128 __attribute__((noinline))
131 arg4_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
132 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
134 return arg4;
137 _Decimal128 __attribute__((noinline))
138 arg5_128 (_Decimal128 arg0, _Decimal128 arg1, _Decimal128 arg2,
139 _Decimal128 arg3, _Decimal128 arg4, _Decimal128 arg5)
141 return arg5;
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;
160 main ()
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
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
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
204 FINISH