Print this page
new smatch
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/validation/constexpr-pointer-arith.c
+++ new/usr/src/tools/smatch/src/validation/constexpr-pointer-arith.c
1 1 static int a = 1;
2 2 static int b[2] = {1, 1};
3 3
4 4 static int *c = &b[1]; // OK
5 5 static int *d = (int*)0 + 1; // OK
6 6 static int *e = &b[1] + 1; // OK
7 7 static int *f = b + 1; // OK
8 8 static int *g = d + 1; // KO
9 9 static int *h = &a + 1; // OK
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
10 10 static int *i = &b[1] + 1; // OK
11 11 static int *j = b + 1; // OK
12 12 static int *k = d + 1; // KO
13 13 static int *l = &*&b[1]; // OK
14 14 static int *m = &*(&a + 1); // OK
15 15 static int *n = &*(&b[1] + 1); // OK
16 16 static int *o = &*(b + 1); // OK
17 17 static int *p = &*(d + 1); // KO
18 18
19 19 /*
20 - * check-name: pointer arithmetic constness verification.
20 + * check-name: consrexprness pointer arithmetic
21 21 * check-command: sparse -Wconstexpr-not-const $file
22 22 *
23 23 * check-error-start
24 24 constexpr-pointer-arith.c:8:19: warning: non-constant initializer for static object
25 25 constexpr-pointer-arith.c:12:19: warning: non-constant initializer for static object
26 26 constexpr-pointer-arith.c:17:22: warning: non-constant initializer for static object
27 27 * check-error-end
28 28 */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX