| 1 |
/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } } */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
|
| 5 |
typedef __INTPTR_TYPE__ intptr_t; |
| 6 |
typedef __UINTPTR_TYPE__ uintptr_t; |
| 7 |
|
| 8 |
void test_1 (void) |
| 9 |
{ |
| 10 |
intptr_t ip; |
| 11 |
void *p = malloc (1024); |
| 12 |
ip = (intptr_t)p; |
| 13 |
free ((void *)ip); |
| 14 |
} /* { dg-bogus "leak" } */ |
| 15 |
|
| 16 |
void test_2 (void) |
| 17 |
{ |
| 18 |
uintptr_t uip; |
| 19 |
void *p = malloc (1024); |
| 20 |
uip = (uintptr_t)p; |
| 21 |
free ((void *)uip); |
| 22 |
} /* { dg-bogus "leak" } */ |
| 23 |
|
| 24 |
void test_3 (intptr_t ip) |
| 25 |
{ |
| 26 |
free ((void *)ip); /* { dg-message "first 'free'" } */ |
| 27 |
free ((void *)ip); /* { dg-warning "double-'free'" } */ |
| 28 |
} |