aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/inlining-6-multiline.c
blob: 9cec6146f3721bb28ea24854a6e072be5c81d2e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* As per inlining-6.c, but testing how the ASCII art version of
   the path looks.  */

/* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */
/* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */

static inline void
inner (void *p)
{
  __builtin_free (p);
}

static inline void
middle (void *q)
{
  inner (q);
  __builtin_free (q); /* { dg-warning "double-'free' of 'r'" } */
}

void
outer (void *r)
{
  middle (r);
}

/* { dg-begin-multiline-output "" }
   __builtin_free (q);
   ^~~~~~~~~~~~~~~~~~
  'outer': events 1-2 (depth 1)
    |
    | outer (void *r)
    | ^~~~~
    | |
    | (1) entry to 'outer'
    |
    |   middle (r);
    |   ~
    |   |
    |   (2) inlined call to 'middle' from 'outer'
    |
    +--> 'middle': event 3 (depth 2)
           |
           |   inner (q);
           |   ^
           |   |
           |   (3) inlined call to 'inner' from 'middle'
           |
           +--> 'inner': event 4 (depth 3)
                  |
                  |   __builtin_free (p);
                  |   ^~~~~~~~~~~~~~~~~~
                  |   |
                  |   (4) first 'free' here
                  |
           <------+
           |
         'middle': event 5 (depth 2)
           |
           |   __builtin_free (q);
           |   ^~~~~~~~~~~~~~~~~~
           |   |
           |   (5) second 'free' here; first 'free' was at (4)
           |
   { dg-end-multiline-output "" } */