Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/inlining-7-multiline.c

raw
1 /* As per inlining-7.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 static inline void
8 depth_6 (void *p)
9 {
10 __builtin_free (p); /* { dg-warning "double-'free' of 'p1'" "warning" } */
11 }
12
13 static inline void
14 depth_5 (void *p5)
15 {
16 depth_6 (p5);
17 }
18
19 static inline void
20 depth_4 (void *p4)
21 {
22 depth_5 (p4);
23 }
24
25 static inline void
26 depth_3 (void *p3)
27 {
28 depth_4 (p3);
29 depth_4 (p3);
30 }
31
32 static inline void
33 depth_2 (void *p2)
34 {
35 depth_3 (p2);
36 }
37
38 void
39 depth_1 (void *p1)
40 {
41 depth_2 (p1);
42 }
43
44 /* We want the reconstructed call/return hierarchy to show
45 that two calls happen at depth_3, without popping the stack
46 back any further. */
47
48 /* { dg-begin-multiline-output "" }
49 __builtin_free (p);
50 ^~~~~~~~~~~~~~~~~~
51 'depth_1': events 1-2 (depth 1)
52 |
53 | depth_1 (void *p1)
54 | ^~~~~~~
55 | |
56 | (1) entry to 'depth_1'
57 |
58 | depth_2 (p1);
59 | ~
60 | |
61 | (2) inlined call to 'depth_2' from 'depth_1'
62 |
63 +--> 'depth_2': event 3 (depth 2)
64 |
65 | depth_3 (p2);
66 | ^
67 | |
68 | (3) inlined call to 'depth_3' from 'depth_2'
69 |
70 +--> 'depth_3': event 4 (depth 3)
71 |
72 | depth_4 (p3);
73 | ^
74 | |
75 | (4) inlined call to 'depth_4' from 'depth_3'
76 |
77 +--> 'depth_4': event 5 (depth 4)
78 |
79 | depth_5 (p4);
80 | ^
81 | |
82 | (5) inlined call to 'depth_5' from 'depth_4'
83 |
84 +--> 'depth_5': event 6 (depth 5)
85 |
86 | depth_6 (p5);
87 | ^
88 | |
89 | (6) inlined call to 'depth_6' from 'depth_5'
90 |
91 +--> 'depth_6': event 7 (depth 6)
92 |
93 | __builtin_free (p);
94 | ^~~~~~~~~~~~~~~~~~
95 | |
96 | (7) first 'free' here
97 |
98 <--------------------+
99 |
100 'depth_3': event 8 (depth 3)
101 |
102 | depth_4 (p3);
103 | ^
104 | |
105 | (8) inlined call to 'depth_4' from 'depth_3'
106 |
107 +--> 'depth_4': event 9 (depth 4)
108 |
109 | depth_5 (p4);
110 | ^
111 | |
112 | (9) inlined call to 'depth_5' from 'depth_4'
113 |
114 +--> 'depth_5': event 10 (depth 5)
115 |
116 | depth_6 (p5);
117 | ^
118 | |
119 | (10) inlined call to 'depth_6' from 'depth_5'
120 |
121 +--> 'depth_6': event 11 (depth 6)
122 |
123 | __builtin_free (p);
124 | ^~~~~~~~~~~~~~~~~~
125 | |
126 | (11) second 'free' here; first 'free' was at (7)
127 |
128 { dg-end-multiline-output "" { target c } } */
129 /* { dg-begin-multiline-output "" }
130 __builtin_free (p);
131 ~~~~~~~~~~~~~~~^~~
132 'void depth_1(void*)': events 1-2 (depth 1)
133 |
134 | depth_1 (void *p1)
135 | ^~~~~~~
136 | |
137 | (1) entry to 'depth_1'
138 |
139 | depth_2 (p1);
140 | ~
141 | |
142 | (2) inlined call to 'depth_2' from 'depth_1'
143 |
144 +--> 'void depth_2(void*)': event 3 (depth 2)
145 |
146 | depth_3 (p2);
147 | ^
148 | |
149 | (3) inlined call to 'depth_3' from 'depth_2'
150 |
151 +--> 'void depth_3(void*)': event 4 (depth 3)
152 |
153 | depth_4 (p3);
154 | ^
155 | |
156 | (4) inlined call to 'depth_4' from 'depth_3'
157 |
158 +--> 'void depth_4(void*)': event 5 (depth 4)
159 |
160 | depth_5 (p4);
161 | ^
162 | |
163 | (5) inlined call to 'depth_5' from 'depth_4'
164 |
165 +--> 'void depth_5(void*)': event 6 (depth 5)
166 |
167 | depth_6 (p5);
168 | ^
169 | |
170 | (6) inlined call to 'depth_6' from 'depth_5'
171 |
172 +--> 'void depth_6(void*)': event 7 (depth 6)
173 |
174 | __builtin_free (p);
175 | ~~~~~~~~~~~~~~~^~~
176 | |
177 | (7) first 'free' here
178 |
179 <--------------------+
180 |
181 'void depth_3(void*)': event 8 (depth 3)
182 |
183 | depth_4 (p3);
184 | ^
185 | |
186 | (8) inlined call to 'depth_4' from 'depth_3'
187 |
188 +--> 'void depth_4(void*)': event 9 (depth 4)
189 |
190 | depth_5 (p4);
191 | ^
192 | |
193 | (9) inlined call to 'depth_5' from 'depth_4'
194 |
195 +--> 'void depth_5(void*)': event 10 (depth 5)
196 |
197 | depth_6 (p5);
198 | ^
199 | |
200 | (10) inlined call to 'depth_6' from 'depth_5'
201 |
202 +--> 'void depth_6(void*)': event 11 (depth 6)
203 |
204 | __builtin_free (p);
205 | ~~~~~~~~~~~~~~~^~~
206 | |
207 | (11) second 'free' here; first 'free' was at (7)
208 |
209 { dg-end-multiline-output "" { target c++ } } */