blob: 7ff42b814400fd44805ca1865f49add24b8216cb (
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
|
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
#include <stdlib.h>
void *
calls_malloc (void)
{
void *result = malloc (1024);
return result;
}
void
calls_free (void *victim)
{
free (victim); /* { dg-warning "double-'free' of 'victim'" } */
/* TODO: this would be better emitted at the callsite,
for such a simple wrapper. */
}
void test (void)
{
void *ptr = calls_malloc ();
calls_free (ptr);
calls_free (ptr); /* BUG: double-'free'. */
}
|