*new* check_macros: find macro precedence bugs
[smatch.git] / validation / sm_loops4.c
blobe3b23944fca1d755f35804be833e97b3b18b5b5e
1 #include "check_debug.h"
3 char *some_func(void);
5 int x,y;
6 int i;
7 void func(void)
9 char *p;
10 char *p2;
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';
24 * check-name: smatch loops #4
25 * check-command: smatch -I.. sm_loops4.c
27 * check-output-start
28 sm_loops4.c +16 func(9) error: potentially derefencing uninitialized 'p'.
29 * check-output-end