check_overflow: store the size in bytes instead of bits.
[smatch.git] / validation / sm_null_deref2.c
blobd461bcf577149bec9bb229ef530c71ade4f963d8
1 int *ptr;
2 int x, y, z;
3 void frob(void) {
4 if ((y && !ptr) || z)
5 return;
6 if (ptr) {
7 /* in the current version of smatch this erases
8 the old implications. Later version should
9 fix this. --Dec 2 2009 */
10 x = *ptr;
12 if (!y && ptr)
13 *ptr = 0; // smatch used to print an error here.
14 if (!y)
15 *ptr = 1;
18 * check-name: Dereferencing Undefined
19 * check-command: smatch --spammy sm_null_deref2.c
21 * check-output-start
22 sm_null_deref2.c +15 frob(12) error: dereferencing undefined: 'ptr'
23 * check-output-end