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