1 2 3 4 5 6 7 8 9 10 11 12
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */ #include <stdlib.h> #include "../../gcc.dg/analyzer/analyzer-decls.h" void *ptr; void test (void) { ptr = malloc (1024); ptr = NULL; /* { dg-warning "leak of 'ptr'" } */ }