xref: /illumos-gate/usr/src/tools/smatch/src/validation/mem2reg/broken-phi02.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)

foo(int a,int b)1*c85f09ccSJohn Levon int foo(int a, int b)
2*c85f09ccSJohn Levon {
3*c85f09ccSJohn Levon 	int x;
4*c85f09ccSJohn Levon 	int i;
5*c85f09ccSJohn Levon 
6*c85f09ccSJohn Levon 	if (a)
7*c85f09ccSJohn Levon 		i = 0;
8*c85f09ccSJohn Levon 	else
9*c85f09ccSJohn Levon 		i = 1;
10*c85f09ccSJohn Levon 
11*c85f09ccSJohn Levon 	x = 0;
12*c85f09ccSJohn Levon 	if (b)
13*c85f09ccSJohn Levon 		x = i;
14*c85f09ccSJohn Levon 	return x;
15*c85f09ccSJohn Levon }
16*c85f09ccSJohn Levon 
17*c85f09ccSJohn Levon /*
18*c85f09ccSJohn Levon  * check-name: broken-phi02
19*c85f09ccSJohn Levon  * check-description:
20*c85f09ccSJohn Levon  *	This is an indirect test to check correctness of phi-node placement.
21*c85f09ccSJohn Levon  *	The misplaced phi-node for 'i' (not at the meet point but where 'i'
22*c85f09ccSJohn Levon  *	is used) causes a missed select-conversion at later stage.
23*c85f09ccSJohn Levon  *
24*c85f09ccSJohn Levon  * check-command: test-linearize -Wno-decl $file
25*c85f09ccSJohn Levon  * check-output-ignore
26*c85f09ccSJohn Levon  * check-output-contains: select\\.
27*c85f09ccSJohn Levon  */
28