xref: /illumos-gate/usr/src/tools/smatch/src/validation/mem2reg/short-load.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1*c85f09ccSJohn Levon #ifdef __SIZEOF_INT__ == 4
2*c85f09ccSJohn Levon typedef unsigned int u32;
3*c85f09ccSJohn Levon #endif
4*c85f09ccSJohn Levon #ifdef __SIZEOF_SHORT__ == 2
5*c85f09ccSJohn Levon typedef unsigned short u16;
6*c85f09ccSJohn Levon #endif
7*c85f09ccSJohn Levon 
8*c85f09ccSJohn Levon 
9*c85f09ccSJohn Levon union u {
10*c85f09ccSJohn Levon 	u32	a;
11*c85f09ccSJohn Levon 	u16	b;
12*c85f09ccSJohn Levon };
13*c85f09ccSJohn Levon 
14*c85f09ccSJohn Levon void bar(u16, union u);
15*c85f09ccSJohn Levon 
foo(u16 val)16*c85f09ccSJohn Levon void foo(u16 val)
17*c85f09ccSJohn Levon {
18*c85f09ccSJohn Levon 	union u u;
19*c85f09ccSJohn Levon 
20*c85f09ccSJohn Levon 	u.b = val;
21*c85f09ccSJohn Levon 	bar(u.b, u);
22*c85f09ccSJohn Levon }
23*c85f09ccSJohn Levon 
24*c85f09ccSJohn Levon /*
25*c85f09ccSJohn Levon  * check-name: short-load
26*c85f09ccSJohn Levon  * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
27*c85f09ccSJohn Levon  * check-output-ignore
28*c85f09ccSJohn Levon  * check-output-contains: load\\.32
29*c85f09ccSJohn Levon  */
30