view gcc/testsuite/gcc.dg/analyzer/edges-2.c @ 19:2b5abeee2509 default tip

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

#include <stdlib.h>

int foo ();
int bar ();

/* Verify that only significant edges are reported.  */

void test (int a, int b, int c)
{
  void *p = malloc (1024); /* { dg-message "allocated here" } */
  while (a) /* { dg-bogus "" } */
    foo ();
  if (b) /* { dg-bogus "" } */
    foo ();
  else
    bar ();
  if (c) /* { dg-message "following 'true' branch" } */
    free (p); /* { dg-message "first 'free' here" } */
  free (p); /* { dg-warning "double-'free' of 'p'" } */
}