blob: ee6e0e01876cf42aedadedb96537f392607aab57 [file] [log] [blame]
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
#include <stdlib.h>
void *
calls_malloc (void)
{
void *result = malloc (1024);
return result;
}
int *test_1 (int i)
{
int *ptr = (int *)calls_malloc ();
*ptr = i; /* { dg-warning "dereference of possibly-NULL 'ptr'" } */
return ptr;
}
/* Same as test_1, to exercise the caches. */
int *test_2 (int i)
{
int *ptr = (int *)calls_malloc ();
*ptr = i; /* { dg-warning "dereference of possibly-NULL 'ptr'" } */
return ptr;
}