extra: get max correctly
[smatch.git] / validation / sm_array_overflow3.c
blob680dca2d6946702665cad43947446b2b89afc92a
1 #include <stdio.h>
3 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
5 int a[] = {1, 2, 3, 4};
7 int main(void)
9 int *p;
11 for (p = a; p < &a[ARRAY_SIZE(a)]; p++)
12 printf("%d\n", *p);
13 p = &a[5];
14 return 0;
17 * check-name: smatch array check #3
18 * check-command: smatch sm_array_overflow3.c
20 * check-output-start
21 sm_array_overflow3.c:13 main() warn: buffer overflow 'a' 4 <= 5
22 * check-output-end