11f5207b7SJohn Levon static int a = 1;
21f5207b7SJohn Levon static int b[2] = {1, 1};
c(void)31f5207b7SJohn Levon static void c(void) {}
41f5207b7SJohn Levon 
51f5207b7SJohn Levon static int *d = &a;		// OK
61f5207b7SJohn Levon static int *e = d;		// KO
71f5207b7SJohn Levon static int *f = b;		// OK
81f5207b7SJohn Levon 
91f5207b7SJohn Levon static void (*g)(void) = c;	// OK
101f5207b7SJohn Levon static void (*h)(void) = &c;	// OK
111f5207b7SJohn Levon 
121f5207b7SJohn Levon static int *i = &*&a;		// OK
131f5207b7SJohn Levon static int *j = &*b;		// OK
141f5207b7SJohn Levon static int *k = &*d;		// KO
151f5207b7SJohn Levon 
161f5207b7SJohn Levon 
l(void)171f5207b7SJohn Levon static void l(void) {
181f5207b7SJohn Levon 	int a = 1;
191f5207b7SJohn Levon 	static int *b = &a;	// KO
201f5207b7SJohn Levon }
211f5207b7SJohn Levon 
m(void)221f5207b7SJohn Levon static void m(void) {
231f5207b7SJohn Levon 	static int a = 1;
241f5207b7SJohn Levon 	static int *b = &a;	// OK
251f5207b7SJohn Levon }
261f5207b7SJohn Levon 
271f5207b7SJohn Levon /*
28*c85f09ccSJohn Levon  * check-name: constexpr static object address
291f5207b7SJohn Levon  * check-command: sparse -Wconstexpr-not-const $file
301f5207b7SJohn Levon  *
311f5207b7SJohn Levon  * check-error-start
321f5207b7SJohn Levon constexpr-addr-of-static.c:6:17: warning: non-constant initializer for static object
331f5207b7SJohn Levon constexpr-addr-of-static.c:14:19: warning: non-constant initializer for static object
341f5207b7SJohn Levon constexpr-addr-of-static.c:19:26: warning: non-constant initializer for static object
351f5207b7SJohn Levon  * check-error-end
361f5207b7SJohn Levon  */
37