1 /* Reproducer for PR analyzer/97258: we should report the double-free
2 inside a static callback if the callback is accessible via a global
3 initializer. */
4
5 #include <stdlib.h>
6
callback_1(void * p)7 static void callback_1 (void *p)
8 {
9 free (p);
10 free (p); /* { dg-warning "double-'free' of 'p'" } */
11 }
12
13 struct ops {
14 void (*cb) (void *);
15 };
16
17 /* Callback struct is not static, and so could be accessed via
18 another TU. */
19
20 const struct ops ops_1 = {
21 .cb = callback_1
22 };
23