Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/explode-3.c

raw
1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
2
3 #include <stdlib.h>
4
5 extern int get (void);
6
7 /* In theory each of p0...p1 can be in various malloc states,
8 independently, so the total combined number of states
9 at any program point within the loop is NUM_VARS * NUM_STATES. */
10
11 void test (void)
12 {
13 void *p0, *p1;
14 void **pp;
15 while (get ())
16 {
17 switch (get ())
18 {
19 default:
20 case 0:
21 pp = &p0;
22 break;
23 case 1:
24 pp = &p1;
25 break;
26 }
27
28 switch (get ())
29 {
30 default:
31 case 0:
32 *pp = malloc (16); /* { dg-warning "leak" "" { xfail *-*-* } } */
33 // TODO: xfail
34 break;
35 case 1:
36 free (*pp);
37 break;
38 case 2:
39 /* no-op. */
40 break;
41 }
42 }
43 }