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
lbar(large_t x
) { return ~x
; }
7 _Bool
qbar(large_t x
) { _Bool r
= ~x
; return r
; }
8 _Bool
lbaz(large_t x
) { return !x
; }
9 _Bool
qbaz(large_t x
) { _Bool r
= !x
; return r
; }
10 _Bool
lqux(large_t x
) { return x
& LBIT
; }
11 _Bool
qqux(large_t x
) { _Bool r
= x
& LBIT
; return r
; }
14 typedef unsigned short __attribute__((bitwise
)) small_t
;
15 #define SBIT ((__attribute__((force)) small_t) 1)
17 _Bool
sfoo(small_t x
) { return x
; }
18 _Bool
tfoo(small_t x
) { _Bool r
= x
; return r
; }
19 _Bool
sbar(small_t x
) { return ~x
; }
20 _Bool
tbar(small_t x
) { _Bool r
= ~x
; return r
; }
21 _Bool
sbaz(small_t x
) { return !x
; }
22 _Bool
tbaz(small_t x
) { _Bool r
= !x
; return r
; }
23 _Bool
squx(small_t x
) { return x
& SBIT
; }
24 _Bool
tqux(small_t x
) { _Bool r
= x
& SBIT
; return r
; }
27 * check-name: bool-cast-restricted.c
28 * check-command: sparse -Wno-decl $file
31 bool-cast-restricted.c:19:32: warning: restricted small_t degrades to integer
32 bool-cast-restricted.c:20:35: warning: restricted small_t degrades to integer