Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/edges-2.c

raw
1 /* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */
2
3 #include <stdlib.h>
4
5 int foo ();
6 int bar ();
7
8 /* Verify that only significant edges are reported. */
9
10 void test (int a, int b, int c)
11 {
12 void *p = malloc (1024); /* { dg-message "allocated here" } */
13 while (a) /* { dg-bogus "" } */
14 foo ();
15 if (b) /* { dg-bogus "" } */
16 foo ();
17 else
18 bar ();
19 if (c) /* { dg-message "following 'true' branch" } */
20 free (p); /* { dg-message "first 'free' here" } */
21 free (p); /* { dg-warning "double-'free' of 'p'" } */
22 }