blob: 5c1cc1a0ef424e7a569f86981153e5352d7bdc26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
#include <stdlib.h>
static int *calls_malloc(void)
{
return (int *) malloc(sizeof(int));
}
int *test(void)
{
int *p = calls_malloc(); /* { dg-message "possible return of NULL to 'test' from 'calls_malloc'" } */
*p = 42; /* { dg-warning "dereference of possibly-NULL 'p'" } */
return p;
}
|