xref: /illumos-gate/usr/src/tools/smatch/src/validation/linear/struct-init-partial.c (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
1 struct s {
2 	int a, b, c;
3 };
4 
5 struct s s_init_first(int a)
6 {
7 	struct s s = { .a = a, };
8 	return s;
9 }
10 
11 struct s s_init_third(int a)
12 {
13 	struct s s = { .c = a, };
14 	return s;
15 }
16 
17 /*
18  * check-name: struct implicit init zero needed
19  * check-command: test-linearize -Wno-decl $file
20  *
21  * check-output-start
22 s_init_first:
23 .L0:
24 	<entry-point>
25 	store.96    $0 -> 0[s]
26 	store.32    %arg1 -> 0[s]
27 	load.96     %r2 <- 0[s]
28 	ret.96      %r2
29 
30 
31 s_init_third:
32 .L2:
33 	<entry-point>
34 	store.96    $0 -> 0[s]
35 	store.32    %arg1 -> 8[s]
36 	load.96     %r5 <- 0[s]
37 	ret.96      %r5
38 
39 
40  * check-output-end
41  */
42