IRA: Ignore debug insns for uses in split_live_ranges_for_shrink_wrap. [PR116179]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / paths-3.c
blobb5ab810e5363d4ebf09b62f7e018eb0d05b10939
1 /* { dg-additional-options "-fanalyzer-transitivity" } */
3 #include <stdlib.h>
4 #include "analyzer-decls.h"
6 int test_1 (int a, int b)
8 void *p;
10 if (a > 5)
11 if (b)
12 p = malloc (16);
13 else
14 p = malloc (32);
16 __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */
18 if (a > 5)
20 free (p);
21 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
24 return 0; /* { dg-bogus "leak" } */
27 int test_2 (int a, int b)
29 void *p;
31 if (a > 5)
32 if (b)
33 p = malloc (16);
34 else
35 p = malloc (32);
37 __analyzer_dump_exploded_nodes (0); /* { dg-warning "3 processed enodes" } */
39 if (a > 6) /* different condition */
41 free (p);
42 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
45 return 0; /* { dg-warning "leak of 'p'" } */
46 /* leaks when a == 5. */