| 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 c } .-1 } */ |
| 15 |
/* { dg-message "\\(7\\) first 'free' here \\(fndecl 'void depth_6\\(void\\*\\)', depth 6\\)" "1st free message" { target c++ } .-2 } */ |
| 16 |
/* { dg-message "\\(11\\) second 'free' here; first 'free' was at \\(7\\) \\(fndecl 'depth_6', depth 6\\)" "2nd free message" { target c } .-3 } */ |
| 17 |
/* { dg-message "\\(11\\) second 'free' here; first 'free' was at \\(7\\) \\(fndecl 'void depth_6\\(void\\*\\)', depth 6\\)" "2nd free message" { target c++ } .-4 } */ |
| 18 |
} |
| 19 |
|
| 20 |
static inline void |
| 21 |
depth_5 (void *p5) |
| 22 |
{ |
| 23 |
depth_6 (p5); /* { dg-message "\\(6\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'depth_5', depth 5\\)" "event 6" { target c } } */ |
| 24 |
/* { dg-message "\\(6\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'void depth_5\\(void\\*\\)', depth 5\\)" "event 6" { target c++ } .-1 } */ |
| 25 |
/* { dg-message "\\(10\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'depth_5', depth 5\\)" "event 10" { target c } .-2 } */ |
| 26 |
/* { dg-message "\\(10\\) inlined call to 'depth_6' from 'depth_5' \\(fndecl 'void depth_5\\(void\\*\\)', depth 5\\)" "event 10" { target c++ } .-3 } */ |
| 27 |
} |
| 28 |
|
| 29 |
static inline void |
| 30 |
depth_4 (void *p4) |
| 31 |
{ |
| 32 |
depth_5 (p4); /* { dg-message "\\(5\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'depth_4', depth 4\\)" "event 5" { target c } } */ |
| 33 |
/* { dg-message "\\(5\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'void depth_4\\(void\\*\\)', depth 4\\)" "event 5" { target c++ } .-1 } */ |
| 34 |
/* { dg-message "\\(9\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'depth_4', depth 4\\)" "event 9" { target c } .-2 } */ |
| 35 |
/* { dg-message "\\(9\\) inlined call to 'depth_5' from 'depth_4' \\(fndecl 'void depth_4\\(void\\*\\)', depth 4\\)" "event 9" { target c++ } .-3 } */ |
| 36 |
} |
| 37 |
|
| 38 |
static inline void |
| 39 |
depth_3 (void *p3) |
| 40 |
{ |
| 41 |
depth_4 (p3); /* { dg-message "\\(4\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'depth_3', depth 3\\)" "" { target c } } */ |
| 42 |
/* { dg-message "\\(4\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'void depth_3\\(void\\*\\)', depth 3\\)" "" { target c++ } .-1 } */ |
| 43 |
depth_4 (p3); /* { dg-message "\\(8\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'depth_3', depth 3\\)" "" { target c } } */ |
| 44 |
/* { dg-message "\\(8\\) inlined call to 'depth_4' from 'depth_3' \\(fndecl 'void depth_3\\(void\\*\\)', depth 3\\)" "" { target c++ } .-1 } */ |
| 45 |
} |
| 46 |
|
| 47 |
static inline void |
| 48 |
depth_2 (void *p2) |
| 49 |
{ |
| 50 |
depth_3 (p2); /* { dg-message "\\(3\\) inlined call to 'depth_3' from 'depth_2' \\(fndecl 'depth_2', depth 2\\)" "" { target c } } */ |
| 51 |
/* { dg-message "\\(3\\) inlined call to 'depth_3' from 'depth_2' \\(fndecl 'void depth_2\\(void\\*\\)', depth 2\\)" "" { target c++ } .-1 } */ |
| 52 |
} |
| 53 |
|
| 54 |
void |
| 55 |
depth_1 (void *p1) /* { dg-message "\\(1\\) entry to 'depth_1' \\(fndecl 'depth_1', depth 1\\)" "" { target c } } */ |
| 56 |
/* { dg-message "\\(1\\) entry to 'depth_1' \\(fndecl 'void depth_1\\(void\\*\\)', depth 1\\)" "" { target c++ } .-1 } */ |
| 57 |
{ |
| 58 |
depth_2 (p1); /* { dg-message "\\(2\\) inlined call to 'depth_2' from 'depth_1' \\(fndecl 'depth_1', depth 1\\)" "" { target c } } */ |
| 59 |
/* { dg-message "\\(2\\) inlined call to 'depth_2' from 'depth_1' \\(fndecl 'void depth_1\\(void\\*\\)', depth 1\\)" "" { target c++ } .-1 } */ |
| 60 |
} |