fix expansion of integers to floats
[smatch.git] / validation / cast-constants.c
blobf47d6fd346814a3778c89ade12da683ff8dbc1e8
1 typedef unsigned int uint;
2 typedef unsigned long ulong;
4 static int uint_2_int(void) { return (int)123U; }
5 static int long_2_int(void) { return (int)123L; }
6 static int ulong_2_int(void) { return (int)123UL; }
7 static int vptr_2_int(void) { return (int)((void*)123); }
8 static int iptr_2_int(void) { return (int)((int*)128); }
9 static int float_2_int(void) { return (int)1.123F; }
10 static int double_2_int(void) { return (int)1.123L; }
11 static uint int_2_uint(void) { return (uint)123; }
12 static uint long_2_uint(void) { return (uint)123L; }
13 static uint ulong_2_uint(void) { return (uint)123UL; }
14 static uint vptr_2_uint(void) { return (uint)((void*)123); }
15 static uint iptr_2_uint(void) { return (uint)((int*)128); }
16 static uint float_2_uint(void) { return (uint)1.123F; }
17 static uint double_2_uint(void) { return (uint)1.123L; }
18 static long int_2_long(void) { return (long)123; }
19 static long uint_2_long(void) { return (long)123U; }
20 static long ulong_2_long(void) { return (long)123UL; }
21 static long vptr_2_long(void) { return (long)((void*)123); }
22 static long iptr_2_long(void) { return (long)((int*)128); }
23 static long float_2_long(void) { return (long)1.123F; }
24 static long double_2_long(void) { return (long)1.123L; }
25 static ulong int_2_ulong(void) { return (ulong)123; }
26 static ulong uint_2_ulong(void) { return (ulong)123U; }
27 static ulong long_2_ulong(void) { return (ulong)123L; }
28 static ulong vptr_2_ulong(void) { return (ulong)((void*)123); }
29 static ulong iptr_2_ulong(void) { return (ulong)((int*)128); }
30 static ulong float_2_ulong(void) { return (ulong)1.123F; }
31 static ulong double_2_ulong(void) { return (ulong)1.123L; }
32 static void * int_2_vptr(void) { return (void *)123; }
33 static void * uint_2_vptr(void) { return (void *)123U; }
34 static void * long_2_vptr(void) { return (void *)123L; }
35 static void * ulong_2_vptr(void) { return (void *)123UL; }
36 static void * iptr_2_vptr(void) { return (void *)((int*)128); }
37 static int * int_2_iptr(void) { return (int *)123; }
38 static int * uint_2_iptr(void) { return (int *)123U; }
39 static int * long_2_iptr(void) { return (int *)123L; }
40 static int * ulong_2_iptr(void) { return (int *)123UL; }
41 static int * vptr_2_iptr(void) { return (int *)((void*)123); }
42 static float int_2_float(void) { return (float)123; }
43 static float uint_2_float(void) { return (float)123U; }
44 static float long_2_float(void) { return (float)123L; }
45 static float ulong_2_float(void) { return (float)123UL; }
46 static float double_2_float(void) { return (float)1.123L; }
47 static double int_2_double(void) { return (double)123; }
48 static double uint_2_double(void) { return (double)123U; }
49 static double long_2_double(void) { return (double)123L; }
50 static double ulong_2_double(void) { return (double)123UL; }
51 static double float_2_double(void) { return (double)1.123F; }
54 * check-name: cast-constants.c
55 * check-command: test-linearize -m64 $file
57 * check-output-start
58 uint_2_int:
59 .L0:
60 <entry-point>
61 ret.32 $123
64 long_2_int:
65 .L2:
66 <entry-point>
67 ret.32 $123
70 ulong_2_int:
71 .L4:
72 <entry-point>
73 ret.32 $123
76 vptr_2_int:
77 .L6:
78 <entry-point>
79 ret.32 $123
82 iptr_2_int:
83 .L8:
84 <entry-point>
85 ret.32 $128
88 float_2_int:
89 .L10:
90 <entry-point>
91 ret.32 $1
94 double_2_int:
95 .L12:
96 <entry-point>
97 ret.32 $1
100 int_2_uint:
101 .L14:
102 <entry-point>
103 ret.32 $123
106 long_2_uint:
107 .L16:
108 <entry-point>
109 ret.32 $123
112 ulong_2_uint:
113 .L18:
114 <entry-point>
115 ret.32 $123
118 vptr_2_uint:
119 .L20:
120 <entry-point>
121 ret.32 $123
124 iptr_2_uint:
125 .L22:
126 <entry-point>
127 ret.32 $128
130 float_2_uint:
131 .L24:
132 <entry-point>
133 ret.32 $1
136 double_2_uint:
137 .L26:
138 <entry-point>
139 ret.32 $1
142 int_2_long:
143 .L28:
144 <entry-point>
145 ret.64 $123
148 uint_2_long:
149 .L30:
150 <entry-point>
151 ret.64 $123
154 ulong_2_long:
155 .L32:
156 <entry-point>
157 ret.64 $123
160 vptr_2_long:
161 .L34:
162 <entry-point>
163 ret.64 $123
166 iptr_2_long:
167 .L36:
168 <entry-point>
169 ret.64 $128
172 float_2_long:
173 .L38:
174 <entry-point>
175 ret.64 $1
178 double_2_long:
179 .L40:
180 <entry-point>
181 ret.64 $1
184 int_2_ulong:
185 .L42:
186 <entry-point>
187 ret.64 $123
190 uint_2_ulong:
191 .L44:
192 <entry-point>
193 ret.64 $123
196 long_2_ulong:
197 .L46:
198 <entry-point>
199 ret.64 $123
202 vptr_2_ulong:
203 .L48:
204 <entry-point>
205 ret.64 $123
208 iptr_2_ulong:
209 .L50:
210 <entry-point>
211 ret.64 $128
214 float_2_ulong:
215 .L52:
216 <entry-point>
217 ret.64 $1
220 double_2_ulong:
221 .L54:
222 <entry-point>
223 ret.64 $1
226 int_2_vptr:
227 .L56:
228 <entry-point>
229 ret.64 $123
232 uint_2_vptr:
233 .L58:
234 <entry-point>
235 ret.64 $123
238 long_2_vptr:
239 .L60:
240 <entry-point>
241 ret.64 $123
244 ulong_2_vptr:
245 .L62:
246 <entry-point>
247 ret.64 $123
250 iptr_2_vptr:
251 .L64:
252 <entry-point>
253 ret.64 $128
256 int_2_iptr:
257 .L66:
258 <entry-point>
259 ret.64 $123
262 uint_2_iptr:
263 .L68:
264 <entry-point>
265 ret.64 $123
268 long_2_iptr:
269 .L70:
270 <entry-point>
271 ret.64 $123
274 ulong_2_iptr:
275 .L72:
276 <entry-point>
277 ret.64 $123
280 vptr_2_iptr:
281 .L74:
282 <entry-point>
283 ret.64 $123
286 int_2_float:
287 .L76:
288 <entry-point>
289 set.32 %r39 <- 123.000000
290 ret.32 %r39
293 uint_2_float:
294 .L78:
295 <entry-point>
296 set.32 %r41 <- 123.000000
297 ret.32 %r41
300 long_2_float:
301 .L80:
302 <entry-point>
303 set.32 %r43 <- 123.000000
304 ret.32 %r43
307 ulong_2_float:
308 .L82:
309 <entry-point>
310 set.32 %r45 <- 123.000000
311 ret.32 %r45
314 double_2_float:
315 .L84:
316 <entry-point>
317 set.32 %r47 <- 1.123000
318 ret.32 %r47
321 int_2_double:
322 .L86:
323 <entry-point>
324 set.64 %r49 <- 123.000000
325 ret.64 %r49
328 uint_2_double:
329 .L88:
330 <entry-point>
331 set.64 %r51 <- 123.000000
332 ret.64 %r51
335 long_2_double:
336 .L90:
337 <entry-point>
338 set.64 %r53 <- 123.000000
339 ret.64 %r53
342 ulong_2_double:
343 .L92:
344 <entry-point>
345 set.64 %r55 <- 123.000000
346 ret.64 %r55
349 float_2_double:
350 .L94:
351 <entry-point>
352 set.64 %r57 <- 1.123000
353 ret.64 %r57
356 * check-output-end