aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-5.c
blob: c66ecb5c5635257db7852fd10a2ad1179180b8d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdlib.h>

static int *calls_malloc(void)
{
  return 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;
}