blob: 4fe76012f0058238c2cd428f314508484ec478ff (
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
|
struct foo
{
char *expr;
};
void
test_1 (__UINTPTR_TYPE__ i)
{
struct foo *f = (struct foo *)i;
f->expr = (char *) __builtin_malloc (1024);
} /* { dg-bogus "leak" } */
void
test_2 (__UINTPTR_TYPE__ i)
{
__builtin_free (((struct foo *)i)->expr);
__builtin_free (((struct foo *)i)->expr); /* { dg-warning "double-'free' of '\\*\\(\\(struct foo \\*\\)i\\)\\.expr'" "" { target c } } */
/* { dg-warning "double-'free' of '\\*\\(\\(foo\\*\\)i\\)\\.foo::expr'" "" { target c++ } .-1 } */
}
void
test_3 (void *p)
{
void **q = (void **)p;
*q = __builtin_malloc (1024);
}
|