1f08c3bdfSopenharmony_citypedef unsigned   int __attribute__((bitwise)) large_t;
2f08c3bdfSopenharmony_ci#define	LBIT	((__attribute__((force)) large_t) 1)
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_ci_Bool lfoo(large_t x) { return x; }
5f08c3bdfSopenharmony_ci_Bool qfoo(large_t x) { _Bool r = x; return r; }
6f08c3bdfSopenharmony_ci_Bool xfoo(large_t x) { return (_Bool)x; }
7f08c3bdfSopenharmony_ci_Bool lbar(large_t x) { return ~x; }
8f08c3bdfSopenharmony_ci_Bool qbar(large_t x) { _Bool r = ~x; return r; }
9f08c3bdfSopenharmony_ci_Bool xbar(large_t x) { return (_Bool)~x; }
10f08c3bdfSopenharmony_ci_Bool lbaz(large_t x) { return !x; }
11f08c3bdfSopenharmony_ci_Bool qbaz(large_t x) { _Bool r = !x; return r; }
12f08c3bdfSopenharmony_ci_Bool xbaz(large_t x) { return (_Bool)!x; }
13f08c3bdfSopenharmony_ci_Bool lqux(large_t x) { return x & LBIT; }
14f08c3bdfSopenharmony_ci_Bool qqux(large_t x) { _Bool r = x & LBIT; return r; }
15f08c3bdfSopenharmony_ci_Bool xqux(large_t x) { return (_Bool)(x & LBIT); }
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci
18f08c3bdfSopenharmony_citypedef unsigned short __attribute__((bitwise)) small_t;
19f08c3bdfSopenharmony_ci#define	SBIT	((__attribute__((force)) small_t) 1)
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ci_Bool sfoo(small_t x) { return x; }
22f08c3bdfSopenharmony_ci_Bool tfoo(small_t x) { _Bool r = x; return r; }
23f08c3bdfSopenharmony_ci_Bool zfoo(small_t x) { return (_Bool)x; }
24f08c3bdfSopenharmony_ci_Bool sbar(small_t x) { return ~x; }
25f08c3bdfSopenharmony_ci_Bool tbar(small_t x) { _Bool r = ~x; return r; }
26f08c3bdfSopenharmony_ci_Bool zbar(small_t x) { return (_Bool)~x; }
27f08c3bdfSopenharmony_ci_Bool sbaz(small_t x) { return !x; }
28f08c3bdfSopenharmony_ci_Bool tbaz(small_t x) { _Bool r = !x; return r; }
29f08c3bdfSopenharmony_ci_Bool zbaz(small_t x) { return (_Bool)!x; }
30f08c3bdfSopenharmony_ci_Bool squx(small_t x) { return x & SBIT; }
31f08c3bdfSopenharmony_ci_Bool tqux(small_t x) { _Bool r = x & SBIT; return r; }
32f08c3bdfSopenharmony_ci_Bool zqux(small_t x) { return (_Bool)(x & SBIT); }
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ci/*
35f08c3bdfSopenharmony_ci * check-name: bool-cast-restricted.c
36f08c3bdfSopenharmony_ci * check-command: sparse -Wno-decl $file
37f08c3bdfSopenharmony_ci *
38f08c3bdfSopenharmony_ci * check-error-start
39f08c3bdfSopenharmony_cibool-cast-restricted.c:24:32: warning: restricted small_t degrades to integer
40f08c3bdfSopenharmony_cibool-cast-restricted.c:25:35: warning: restricted small_t degrades to integer
41f08c3bdfSopenharmony_cibool-cast-restricted.c:26:33: warning: restricted small_t degrades to integer
42f08c3bdfSopenharmony_ci * check-error-end
43f08c3bdfSopenharmony_ci */
44