| 1 |
/* { dg-additional-options "-Wno-analyzer-symbol-too-complex" } */ |
| 2 |
|
| 3 |
struct node |
| 4 |
{ |
| 5 |
struct node *next; |
| 6 |
}; |
| 7 |
|
| 8 |
void test_1 (struct node *n) |
| 9 |
{ |
| 10 |
while (n) |
| 11 |
{ |
| 12 |
struct node *next = n->next; |
| 13 |
__builtin_free (n); |
| 14 |
n = next; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
extern void *get_ptr (void); |
| 19 |
|
| 20 |
void test_2 (void) |
| 21 |
{ |
| 22 |
void *p; |
| 23 |
while (p = get_ptr ()) |
| 24 |
__builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */ |
| 25 |
} |
| 26 |
|
| 27 |
extern void **get_ptr_ptr (void); |
| 28 |
|
| 29 |
void test_3 (void) |
| 30 |
{ |
| 31 |
void **p; |
| 32 |
while (p = get_ptr_ptr ()) |
| 33 |
__builtin_free (*p); /* { dg-bogus "double-'free'" } */ |
| 34 |
} |
| 35 |
|
| 36 |
void test_4 (void) |
| 37 |
{ |
| 38 |
void *p = (void *)0; |
| 39 |
while (1) |
| 40 |
{ |
| 41 |
__builtin_free (p); /* { dg-bogus "double-'free' of 'p'" } */ |
| 42 |
p = get_ptr (); |
| 43 |
} |
| 44 |
} |