blob: b80ae0359889689366db96edfc1d396b54c9324f [file] [log] [blame]
/* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */
#include <stdlib.h>
/**************************************************************************/
static void maybe_calls_free_1(int *q, int flag)
{
if (flag)
free(q); /* { dg-warning "double-'free' of 'q'" } */
}
void test_1(void *p)
{
maybe_calls_free_1((int *) p, 1);
maybe_calls_free_1((int *) p, 1);
}
/**************************************************************************/
static void maybe_calls_free_2(int *q, int flag)
{
if (flag)
free(q); /* { dg-bogus "double-'free'" } */
}
void test_2(void *p)
{
maybe_calls_free_2((int *) p, 0);
maybe_calls_free_2((int *) p, 0);
}