| 1 |
/* DWARF5 variant of inline2. |
| 2 |
Origin: PR debug/37801 |
| 3 |
|
| 4 |
Abstract instances (DW_TAG_subroutines having the DW_AT_inline attribute) |
| 5 |
of second and first were having a DW_TAG_lexical_block DIE wrongly |
| 6 |
representing the inlined calls to third (in second) and to |
| 7 |
second (in first). At the same time, main didn't have children |
| 8 |
DW_TAG_inlined_subroutine DIEs representing the inlined calls to |
| 9 |
first, second and third. |
| 10 |
|
| 11 |
The ideal goal here is to test that we have no superfluous |
| 12 |
DW_TAG_lexical_block DIE anymore, that abstract instances DIEs have |
| 13 |
no descendant DIE with a DW_AT_abstract_origin attribute, and that main has |
| 14 |
properly nested DW_TAG_inlined_subroutine DIEs for third, second and first. |
| 15 |
*/ |
| 16 |
|
| 17 |
/* Explicitly use dwarf-5 which uses DW_FORM_implicit_const. */ |
| 18 |
/* { dg-do compile } */ |
| 19 |
/* { dg-options "-O -g3 -gdwarf-5 -gno-strict-dwarf -dA -fgnu89-inline -gno-as-loc-support" } */ |
| 20 |
|
| 21 |
/* There are 6 inlined subroutines: |
| 22 |
- One for each subroutine inlined into main, that's 3. |
| 23 |
- One for earch subroutine inline into the out of line instances |
| 24 |
of third, second and first. */ |
| 25 |
/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_inlined_subroutine" 6 } } */ |
| 26 |
|
| 27 |
/* We should have no DW_TAG_lexical_block DIEs, all inline instances |
| 28 |
should have the first subblock elided to match the abstract instance |
| 29 |
layout. */ |
| 30 |
/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_lexical_block" 0 } } */ |
| 31 |
|
| 32 |
/* Each inline instance should have DW_AT_entry_pc and DW_AT_GNU_entry_view. */ |
| 33 |
/* { dg-final { scan-assembler-times " DW_AT_entry_pc" 6 } } */ |
| 34 |
/* { dg-final { scan-assembler-times " DW_AT_GNU_entry_view" 6 } } */ |
| 35 |
/* { dg-final { scan-assembler-times "uleb128\[^\n\]*LVU\[^\n\]* (View list|Location view) (begin|end)" 0 } } */ |
| 36 |
/* { dg-final { scan-assembler-times "uleb128\[^\n\]*0xffffffff\[^\n\]* (View list|Location view) (begin|end)" 0 } } */ |
| 37 |
|
| 38 |
/* There are 3 DW_AT_inline attributes: one per abstract inline instance. |
| 39 |
The value of the attribute must be 0x3, meaning the function was |
| 40 |
actually inlined. */ |
| 41 |
/* { dg-final { scan-assembler-times " DW_AT_inline \\(0x3\\)" 3 } } */ |
| 42 |
|
| 43 |
volatile int *a; |
| 44 |
|
| 45 |
inline void |
| 46 |
third (int arg3) |
| 47 |
{ |
| 48 |
int var3 = arg3; |
| 49 |
a[0] = var3; |
| 50 |
} |
| 51 |
|
| 52 |
inline void |
| 53 |
second (int arg2) |
| 54 |
{ |
| 55 |
int var2 = arg2; |
| 56 |
third (var2+1); |
| 57 |
} |
| 58 |
|
| 59 |
inline void |
| 60 |
first (int arg1) |
| 61 |
{ |
| 62 |
int var1 = arg1; |
| 63 |
second (var1+1); |
| 64 |
} |
| 65 |
|
| 66 |
int |
| 67 |
main () |
| 68 |
{ |
| 69 |
int some_int = 1; |
| 70 |
first (some_int); |
| 71 |
return 0; |
| 72 |
} |
| 73 |
|
| 74 |
|