xref: /illumos-gate/usr/src/tools/smatch/src/validation/linear/struct-init-partial.c (revision cd61ae21816e53b94bc1673f3f1aa651fc3115e8)
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