xref: /illumos-gate/usr/src/tools/smatch/src/validation/mem2reg/loop02-pointer.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1*c85f09ccSJohn Levon 
2*c85f09ccSJohn Levon 
foo(int * i)3*c85f09ccSJohn Levon int foo(int *i)
4*c85f09ccSJohn Levon {
5*c85f09ccSJohn Levon 	int j = 1;
6*c85f09ccSJohn Levon 	*i = 6;
7*c85f09ccSJohn Levon 
8*c85f09ccSJohn Levon 	do {
9*c85f09ccSJohn Levon 		if (*i != 6)
10*c85f09ccSJohn Levon 			(*i)++;
11*c85f09ccSJohn Levon 		(*i)++;
12*c85f09ccSJohn Levon 	} while (*i != j);
13*c85f09ccSJohn Levon 
14*c85f09ccSJohn Levon 	return j;
15*c85f09ccSJohn Levon }
16*c85f09ccSJohn Levon 
17*c85f09ccSJohn Levon /*
18*c85f09ccSJohn Levon  * check-name: loop02 pointer
19*c85f09ccSJohn Levon  * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
20*c85f09ccSJohn Levon  * check-output-ignore
21*c85f09ccSJohn Levon  * check-output-pattern(0,4): load\\.
22*c85f09ccSJohn Levon  * check-output-pattern(1,3): store\\.
23*c85f09ccSJohn Levon  */
24