xref: /illumos-gate/usr/src/tools/smatch/src/validation/mem2reg/alias-mixed.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1*c85f09ccSJohn Levon extern int g;
2*c85f09ccSJohn Levon 
3*c85f09ccSJohn Levon 
foo(int * p)4*c85f09ccSJohn Levon static int foo(int *p)
5*c85f09ccSJohn Levon {
6*c85f09ccSJohn Levon 	*p = 1;
7*c85f09ccSJohn Levon 	g = 2;
8*c85f09ccSJohn Levon 	return *p == 1;
9*c85f09ccSJohn Levon }
10*c85f09ccSJohn Levon 
bar(int * p)11*c85f09ccSJohn Levon static int bar(int *p)
12*c85f09ccSJohn Levon {
13*c85f09ccSJohn Levon 	g = 1;
14*c85f09ccSJohn Levon 	*p = 2;
15*c85f09ccSJohn Levon 	return g == 1;
16*c85f09ccSJohn Levon }
17*c85f09ccSJohn Levon 
test(void)18*c85f09ccSJohn Levon static void test(void)
19*c85f09ccSJohn Levon {
20*c85f09ccSJohn Levon 	foo(&g);
21*c85f09ccSJohn Levon 	bar(&g);
22*c85f09ccSJohn Levon }
23*c85f09ccSJohn Levon 
24*c85f09ccSJohn Levon /*
25*c85f09ccSJohn Levon  * check-name: alias symbol/pointer
26*c85f09ccSJohn Levon  * check-command: test-linearize $file
27*c85f09ccSJohn Levon  * check-output-ignore
28*c85f09ccSJohn Levon  *
29*c85f09ccSJohn Levon  * check-output-excludes: ret\\..* *\\$1
30*c85f09ccSJohn Levon  */
31