1 #include "check_debug.h"
2 
3 char *some_func(void);
4 
5 int x,y;
6 int i;
func(void)7 void func(void)
8 {
9 	char *p;
10 	char *p2;
11 
12 	if (x > 0)
13 		p = some_func();
14 	for (i = 0; i < x; i++)
15 		*p = 'x';
16 	*p = 'x';
17 	if (y > 0)
18 		p2 = some_func();
19 	i = 0;
20 	if (i < y)
21 		*p2 = 'x';
22 }
23 /*
24  * check-name: smatch loops #4
25  * check-command: smatch -I.. sm_loops4.c
26  *
27  * check-output-start
28 sm_loops4.c:16 func() error: potentially dereferencing uninitialized 'p'.
29  * check-output-end
30  */
31