aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim/bitfield-size.c
blob: ea1ed57fb8fe5791cef8139c090a9e6465c76156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
struct bfu {
	unsigned int a:4;
	unsigned int  :2;
	unsigned int b:4;
};
unsigned int get__bfu_a(struct bfu bf) { return bf.a; }
unsigned int get__bfu_b(struct bfu bf) { return bf.b; }
unsigned int get_pbfu_a(struct bfu *bf) { return bf->a; }
unsigned int get_pbfu_b(struct bfu *bf) { return bf->b; }


struct bfs {
	signed int a:4;
	signed int  :2;
	signed int b:4;
};
signed int get__bfs_a(struct bfs bf) { return bf.a; }
signed int get__bfs_b(struct bfs bf) { return bf.b; }
signed int get_pbfs_a(struct bfs *bf) { return bf->a; }
signed int get_pbfs_b(struct bfs *bf) { return bf->b; }

/*
 * check-name: bitfield size
 * check-command: test-linearize -Wno-decl $file
 * check-output-ignore
 *
 * check-output-excludes: and\\..*\\$960
 * check-output-excludes: zext\\.
 * check-output-pattern(4): and\\..*\\$15
 * check-output-pattern(4): sext\\.
 * check-output-pattern(4): trunc\\.4
 * check-output-pattern(4): lsr\\..*\\$6
 */