xref: /illumos-gate/usr/src/tools/smatch/src/validation/linear/bitfield-store.c (revision f34e64d88f694155255ac1c93990904dbfa28af3)
1 int foo(void)
2 {
3 	struct {
4 		int a:8;
5 		int b:16;
6 		int c:8;
7 	} s = { 0xff, 0x0000, 0xff };
8 
9 	return s.b = 0x56781234;
10 }
11 
12 /*
13  * check-name: bitfield-store
14  * check-command: test-linearize -Wno-decl $file
15  *
16  * check-output-ignore
17  * check-output-contains: ret\\..*\\$0x1234
18  *
19  * check-error-start
20 linear/bitfield-store.c:9:22: warning: cast truncates bits from constant value (56781234 becomes 1234)
21  * check-error-end
22  */
23