1 /* Verify that we can reconstruct fndecl and stack depth information
2 after early inlining. */
3
4 /* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */
5
6 /* We want the reconstructed call/return hierarchy to show
7 that two calls happen at depth_3, without any spurious events
8 popping the stack back any further. */
9
10 static inline void
11 depth_6 (void *p)
12 {
13 __builtin_free (p); /* { dg-warning "double-'free' of 'p1'" "warning" } */
14 /* { dg-message "\\(7\\) first 'free' here \\(fndecl 'depth_6', depth 6\\)" "1st free message" { target *-*-* } .-1 } */
15 /* { dg-message "\\(11\\) second 'free' here; first 'free' was at \\(7\\) \\(fndecl 'depth_6', depth 6\\)" "2nd free message" { target *-*-* } .-2 } */
16 }
17
18 static inline void
19 depth_5 (void *p5)
20 {
21 depth_6 (p5); /* { dg-message "\\(6\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'depth_5', depth 5\\)" "event 6" } */
22 /* { dg-message "\\(10\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'depth_5', depth 5\\)" "event 10" { target *-*-* } .-1 } */
23 }
24
25 static inline void
26 depth_4 (void *p4)
27 {
28 depth_5 (p4); /* { dg-message "\\(5\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'depth_4', depth 4\\)" "event 5" } */
29 /* { dg-message "\\(9\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'depth_4', depth 4\\)" "event 9" { target *-*-* } .-1 } */
30 }
31
32 static inline void
33 depth_3 (void *p3)
34 {
35 depth_4 (p3); /* { dg-message "\\(4\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'depth_3', depth 3\\)" } */
36 depth_4 (p3); /* { dg-message "\\(8\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'depth_3', depth 3\\)" } */
37 }
38
39 static inline void
40 depth_2 (void *p2)
41 {
42 depth_3 (p2); /* { dg-message "\\(3\\) inlined call to 'depth_3' from 'depth_2' \\(fndecl 'depth_2', depth 2\\)" } */
43 }
44
45 void
46 depth_1 (void *p1) /* { dg-message "\\(1\\) entry to 'depth_1' \\(fndecl 'depth_1', depth 1\\)" } */
47 {
48 depth_2 (p1); /* { dg-message "\\(2\\) inlined call to 'depth_2' from 'depth_1' \\(fndecl 'depth_1', depth 1\\)" } */
49 }