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

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

/* { dg-additional-options "-Wno-incompatible-pointer-types" } */

#include <stdlib.h>

struct foo;
struct bar;
void *hv (struct foo **tm)
{
  void *p = __builtin_malloc (4);
  *tm = p;
  if (!p)
    abort ();
  return p; /* { dg-warning "leak of 'tm'" } */
}

void a5 (void)
{
  struct bar *qb = NULL;
  hv (&qb);
} /* { dg-warning "leak of '\\(struct foo \\*\\)qb'" } */