view gcc/testsuite/gcc.dg/analyzer/malloc-ipa-6.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

#include <stdlib.h>

void *
calls_malloc (void)
{
  void *result = malloc (1024); /* { dg-message "allocated here" } */
  return result; /* { dg-warning "leak of 'result'" } */
}

void test_1 ()
{
  calls_malloc (); /* { dg-message "calling 'calls_malloc' from 'test_1'" } */
}

static void callee (int i)
{
}

void test_2 (int i)
{
  callee (i);
}