11f5207b7SJohn Levon static int a = 1;
21f5207b7SJohn Levon static int b[2] = {1, 1};
31f5207b7SJohn Levon 
41f5207b7SJohn Levon static int *c = &b[1];					// OK
51f5207b7SJohn Levon static int *d = (int*)0 + 1;				// OK
61f5207b7SJohn Levon static int *e = &b[1] + 1;				// OK
71f5207b7SJohn Levon static int *f = b + 1;					// OK
81f5207b7SJohn Levon static int *g = d + 1;					// KO
91f5207b7SJohn Levon static int *h = &a + 1;				// OK
101f5207b7SJohn Levon static int *i = &b[1] + 1;				// OK
111f5207b7SJohn Levon static int *j = b + 1;					// OK
121f5207b7SJohn Levon static int *k = d + 1;					// KO
131f5207b7SJohn Levon static int *l = &*&b[1];				// OK
141f5207b7SJohn Levon static int *m = &*(&a + 1);				// OK
151f5207b7SJohn Levon static int *n = &*(&b[1] + 1);				// OK
161f5207b7SJohn Levon static int *o = &*(b + 1);				// OK
171f5207b7SJohn Levon static int *p = &*(d + 1);				// KO
181f5207b7SJohn Levon 
191f5207b7SJohn Levon /*
20*c85f09ccSJohn Levon  * check-name: consrexprness pointer arithmetic
211f5207b7SJohn Levon  * check-command: sparse -Wconstexpr-not-const $file
221f5207b7SJohn Levon  *
231f5207b7SJohn Levon  * check-error-start
241f5207b7SJohn Levon constexpr-pointer-arith.c:8:19: warning: non-constant initializer for static object
251f5207b7SJohn Levon constexpr-pointer-arith.c:12:19: warning: non-constant initializer for static object
261f5207b7SJohn Levon constexpr-pointer-arith.c:17:22: warning: non-constant initializer for static object
271f5207b7SJohn Levon  * check-error-end
281f5207b7SJohn Levon  */
29