view gcc/testsuite/gcc.dg/analyzer/malloc-ipa-5.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

#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;
}