xref: /illumos-gate/usr/src/tools/smatch/src/validation/linear/bool-cast.c (revision 4c87aefe8930bd07275b8dd2e96ea5f24d93a52e)
1 extern int fun(void);
2 typedef unsigned int	u32;
3 typedef          int	s32;
4 typedef void *vdp;
5 typedef int  *sip;
6 typedef double dbl;
7 typedef unsigned short __attribute__((bitwise)) le16;
8 
9 static _Bool fs32_i(s32 a) { return a; }
10 static _Bool fs32_e(s32 a) { return (_Bool)a; }
11 static _Bool fu32_i(u32 a) { return a; }
12 static _Bool fu32_e(u32 a) { return (_Bool)a; }
13 static _Bool fvdp_i(vdp a) { return a; }
14 static _Bool fvdp_e(vdp a) { return (_Bool)a; }
15 static _Bool fsip_i(sip a) { return a; }
16 static _Bool fsip_e(sip a) { return (_Bool)a; }
17 static _Bool ffun_i(void)  { return fun; }
18 static _Bool ffun_e(void)  { return (_Bool)fun; }
19 static _Bool fres_i(le16 a) { return a; }
20 static _Bool fres_e(le16 a) { return (_Bool)a; }
21 static _Bool fdbl_i(dbl a) { return a; }
22 static _Bool fdbl_e(dbl a) { return (_Bool)a; }
23 
24 /*
25  * check-name: bool-cast
26  * check-command: test-linearize -m64 -fdump-ir=linearize $file
27  * check-assert: sizeof(void*) == 8 && sizeof(long) == 8 && sizeof(double) == 8
28  *
29  * check-output-ignore
30  * check-output-excludes: cast\\.
31  * check-output-excludes: fcvt[us]\\.
32  * check-output-excludes: ptrtu\\.
33  * check-output-excludes: [sz]ext\\.
34  * check-output-excludes: trunc\\.
35  * check-output-pattern(12): setne\\.
36  * check-output-pattern(2): fcmpune\\.
37  */
38