1 /* As per inlining-4.c, but testing how the ASCII art version of
2 the path looks. */
3
4 /* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */
5 /* { dg-additional-options "-fdiagnostics-path-format=inline-events -fdiagnostics-show-caret" } */
6
7 #define NULL ((void *)0)
8
9 static inline const char*
10 inner (int flag)
11 {
12 if (flag)
13 return NULL;
14 return "foo";
15 }
16
17 static inline const char*
18 middle (int flag)
19 {
20 return inner (flag);
21 }
22
23 char
24 outer (int flag)
25 {
26 return *middle (flag); /* { dg-warning "dereference of NULL" "warning" } */
27 }
28
29 /* { dg-begin-multiline-output "" }
30 return *middle (flag);
31 ^~~~~~~~~~~~~~
32 'outer': events 1-2 (depth 1)
33 |
34 | outer (int flag)
35 | ^~~~~
36 | |
37 | (1) entry to 'outer'
38 |
39 | return *middle (flag);
40 | ~
41 | |
42 | (2) inlined call to 'middle' from 'outer'
43 |
44 +--> 'middle': event 3 (depth 2)
45 |
46 | return inner (flag);
47 | ^
48 | |
49 | (3) inlined call to 'inner' from 'middle'
50 |
51 +--> 'inner': event 4 (depth 3)
52 |
53 | if (flag)
54 | ^
55 | |
56 | (4) following 'true' branch (when 'flag != 0')...
57 |
58 <-------------+
59 |
60 'outer': event 5 (depth 1)
61 |
62 |cc1:
63 | (5): ...to here
64 |
65 'outer': event 6 (depth 1)
66 |
67 | return *middle (flag);
68 | ^~~~~~~~~~~~~~
69 | |
70 | (6) dereference of NULL '<unknown>'
71 |
72 { dg-end-multiline-output "" } */