aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/edges-2.c
blob: 847a70883fb63d0992cc3e28090d53d1b61ceeae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#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'" } */
}