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