Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/explode-2a.c

raw
1 /* PR analyzer/101068. */
2
3 /* { dg-additional-options "--param analyzer-max-enodes-per-program-point=200 --param analyzer-bb-explosion-factor=50" } */
4
5 #include <stdlib.h>
6
7 extern int get (void);
8
9 void test (void)
10 {
11 void *p0 = NULL, *p1 = NULL, *p2 = NULL, *p3 = NULL;
12 /* Due to not purging constraints on SSA names within loops
13 (PR analyzer/101068), the analyzer effectively treats the original
14 explode-2.c as this code. */
15 int a = get ();
16 int b = get ();
17 while (a) /* { dg-warning "infinite loop" } */
18 {
19 switch (b)
20 {
21 default:
22 case 0:
23 p0 = malloc (16); /* { dg-warning "leak" } */
24 break;
25 case 1:
26 free (p0); /* { dg-warning "double-'free' of 'p0'" "" { xfail *-*-* } } */
27 break;
28
29 case 2:
30 p1 = malloc (16); /* { dg-warning "leak" } */
31 break;
32 case 3:
33 free (p1); /* { dg-warning "double-'free' of 'p1'" "" { xfail *-*-* } } */
34 break;
35
36 case 4:
37 p2 = malloc (16); /* { dg-warning "leak" } */
38 break;
39 case 5:
40 free (p2); /* { dg-warning "double-'free' of 'p2'" "" { xfail *-*-* } } */
41 break;
42
43 case 6:
44 p3 = malloc (16); /* { dg-warning "leak" } */
45 break;
46 case 7:
47 free (p3); /* { dg-warning "double-'free' of 'p3'" "" { xfail *-*-* } } */
48 break;
49 }
50 }
51 }