xref: /illumos-gate/usr/src/tools/smatch/src/validation/linear/cast-constants.c (revision b531f6d16eb39863e7bbc34773fb7ef7a282a0a2)
1 typedef unsigned int uint;
2 typedef unsigned long ulong;
3 
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; }
52 
53 /*
54  * check-name: cast-constants.c
55  * check-command: test-linearize -m64 $file
56  * check-assert: sizeof(void *) == 8 && sizeof(long) == 8 && sizeof(double) == 8
57  *
58  * check-output-start
59 uint_2_int:
60 .L0:
61 	<entry-point>
62 	ret.32      $123
63 
64 
65 long_2_int:
66 .L2:
67 	<entry-point>
68 	ret.32      $123
69 
70 
71 ulong_2_int:
72 .L4:
73 	<entry-point>
74 	ret.32      $123
75 
76 
77 vptr_2_int:
78 .L6:
79 	<entry-point>
80 	ret.32      $123
81 
82 
83 iptr_2_int:
84 .L8:
85 	<entry-point>
86 	ret.32      $128
87 
88 
89 float_2_int:
90 .L10:
91 	<entry-point>
92 	ret.32      $1
93 
94 
95 double_2_int:
96 .L12:
97 	<entry-point>
98 	ret.32      $1
99 
100 
101 int_2_uint:
102 .L14:
103 	<entry-point>
104 	ret.32      $123
105 
106 
107 long_2_uint:
108 .L16:
109 	<entry-point>
110 	ret.32      $123
111 
112 
113 ulong_2_uint:
114 .L18:
115 	<entry-point>
116 	ret.32      $123
117 
118 
119 vptr_2_uint:
120 .L20:
121 	<entry-point>
122 	ret.32      $123
123 
124 
125 iptr_2_uint:
126 .L22:
127 	<entry-point>
128 	ret.32      $128
129 
130 
131 float_2_uint:
132 .L24:
133 	<entry-point>
134 	ret.32      $1
135 
136 
137 double_2_uint:
138 .L26:
139 	<entry-point>
140 	ret.32      $1
141 
142 
143 int_2_long:
144 .L28:
145 	<entry-point>
146 	ret.64      $123
147 
148 
149 uint_2_long:
150 .L30:
151 	<entry-point>
152 	ret.64      $123
153 
154 
155 ulong_2_long:
156 .L32:
157 	<entry-point>
158 	ret.64      $123
159 
160 
161 vptr_2_long:
162 .L34:
163 	<entry-point>
164 	ret.64      $123
165 
166 
167 iptr_2_long:
168 .L36:
169 	<entry-point>
170 	ret.64      $128
171 
172 
173 float_2_long:
174 .L38:
175 	<entry-point>
176 	ret.64      $1
177 
178 
179 double_2_long:
180 .L40:
181 	<entry-point>
182 	ret.64      $1
183 
184 
185 int_2_ulong:
186 .L42:
187 	<entry-point>
188 	ret.64      $123
189 
190 
191 uint_2_ulong:
192 .L44:
193 	<entry-point>
194 	ret.64      $123
195 
196 
197 long_2_ulong:
198 .L46:
199 	<entry-point>
200 	ret.64      $123
201 
202 
203 vptr_2_ulong:
204 .L48:
205 	<entry-point>
206 	ret.64      $123
207 
208 
209 iptr_2_ulong:
210 .L50:
211 	<entry-point>
212 	ret.64      $128
213 
214 
215 float_2_ulong:
216 .L52:
217 	<entry-point>
218 	ret.64      $1
219 
220 
221 double_2_ulong:
222 .L54:
223 	<entry-point>
224 	ret.64      $1
225 
226 
227 int_2_vptr:
228 .L56:
229 	<entry-point>
230 	ret.64      $123
231 
232 
233 uint_2_vptr:
234 .L58:
235 	<entry-point>
236 	ret.64      $123
237 
238 
239 long_2_vptr:
240 .L60:
241 	<entry-point>
242 	ret.64      $123
243 
244 
245 ulong_2_vptr:
246 .L62:
247 	<entry-point>
248 	ret.64      $123
249 
250 
251 iptr_2_vptr:
252 .L64:
253 	<entry-point>
254 	ret.64      $128
255 
256 
257 int_2_iptr:
258 .L66:
259 	<entry-point>
260 	ret.64      $123
261 
262 
263 uint_2_iptr:
264 .L68:
265 	<entry-point>
266 	ret.64      $123
267 
268 
269 long_2_iptr:
270 .L70:
271 	<entry-point>
272 	ret.64      $123
273 
274 
275 ulong_2_iptr:
276 .L72:
277 	<entry-point>
278 	ret.64      $123
279 
280 
281 vptr_2_iptr:
282 .L74:
283 	<entry-point>
284 	ret.64      $123
285 
286 
287 int_2_float:
288 .L76:
289 	<entry-point>
290 	setfval.32  %r39 <- 1.230000e+02
291 	ret.32      %r39
292 
293 
294 uint_2_float:
295 .L78:
296 	<entry-point>
297 	setfval.32  %r41 <- 1.230000e+02
298 	ret.32      %r41
299 
300 
301 long_2_float:
302 .L80:
303 	<entry-point>
304 	setfval.32  %r43 <- 1.230000e+02
305 	ret.32      %r43
306 
307 
308 ulong_2_float:
309 .L82:
310 	<entry-point>
311 	setfval.32  %r45 <- 1.230000e+02
312 	ret.32      %r45
313 
314 
315 double_2_float:
316 .L84:
317 	<entry-point>
318 	setfval.32  %r47 <- 1.123000e+00
319 	ret.32      %r47
320 
321 
322 int_2_double:
323 .L86:
324 	<entry-point>
325 	setfval.64  %r49 <- 1.230000e+02
326 	ret.64      %r49
327 
328 
329 uint_2_double:
330 .L88:
331 	<entry-point>
332 	setfval.64  %r51 <- 1.230000e+02
333 	ret.64      %r51
334 
335 
336 long_2_double:
337 .L90:
338 	<entry-point>
339 	setfval.64  %r53 <- 1.230000e+02
340 	ret.64      %r53
341 
342 
343 ulong_2_double:
344 .L92:
345 	<entry-point>
346 	setfval.64  %r55 <- 1.230000e+02
347 	ret.64      %r55
348 
349 
350 float_2_double:
351 .L94:
352 	<entry-point>
353 	setfval.64  %r57 <- 1.123000e+00
354 	ret.64      %r57
355 
356 
357  * check-output-end
358  */
359