1 #include <stdlib.h>
2 
3 /**************************************************************************/
4 
maybe_calls_free_1(int * q,int flag)5 static void maybe_calls_free_1(int *q, int flag)
6 {
7   if (flag)
8     free(q); /* { dg-warning "double-'free' of 'q'" } */
9 }
10 
test_1(void * p)11 void test_1(void *p)
12 {
13   maybe_calls_free_1(p, 1);
14   maybe_calls_free_1(p, 1);
15 }
16 
17 /**************************************************************************/
18 
maybe_calls_free_2(int * q,int flag)19 static void maybe_calls_free_2(int *q, int flag)
20 {
21   if (flag)
22     free(q); /* { dg-bogus "double-'free'" } */
23 }
24 
test_2(void * p)25 void test_2(void *p)
26 {
27   maybe_calls_free_2(p, 0);
28   maybe_calls_free_2(p, 0);
29 }
30