| 1 |
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 5 |
|
| 6 |
extern void foo (int *); |
| 7 |
|
| 8 |
void test (int n) |
| 9 |
{ |
| 10 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 11 |
|
| 12 |
for (int i = 0; i < n; i++) |
| 13 |
{ |
| 14 |
int *ptr = (int *)malloc (sizeof (int) * i); |
| 15 |
foo (ptr); |
| 16 |
free (ptr); |
| 17 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */ |
| 18 |
} |
| 19 |
|
| 20 |
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */ |
| 21 |
} |