[llvm-bugs] [Bug 30637] New: Orphaned DWARF for static local of inlined func

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 7 09:46:11 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30637

            Bug ID: 30637
           Summary: Orphaned DWARF for static local of inlined func
           Product: libraries
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: paul_robinson at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Debug info for this case has regressed in 3.9.

////////////////////////////////
__attribute__((always_inline)) static int inlined(int i) {
  static int a = 0;
  a += i;
  return a;
}
int main() {
  return inlined(4);
}
////////////////////////////////

In 3.8, we get this: 
================================
<1><2a>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2b>   DW_AT_abstract_origin: <0x4c>
 <2><2f>: Abbrev Number: 3 (DW_TAG_variable)
    <30>   DW_AT_name        : (indirect string, offset: 0x5f): a
    <34>   DW_AT_type        : <0x45>
    <38>   DW_AT_decl_file   : 1
    <39>   DW_AT_decl_line   : 2
    <3a>   DW_AT_location    : 9 byte block: 3 0 0 0 0 0 0 0 0     (DW_OP_addr:
0)

 <1><4c>: Abbrev Number: 5 (DW_TAG_subprogram)
    <4d>   DW_AT_linkage_name: (indirect string, offset: 0x65): _ZL7inlinedi
    <51>   DW_AT_name        : (indirect string, offset: 0x72): inlined
    <55>   DW_AT_decl_file   : 1
    <56>   DW_AT_decl_line   : 1
    <57>   DW_AT_type        : <0x45>
    <5b>   DW_AT_inline      : 1    (inlined)
 <2><5c>: Abbrev Number: 6 (DW_TAG_formal_parameter)
    <5d>   DW_AT_name        : (indirect string, offset: 0x7a): i
    <61>   DW_AT_decl_file   : 1
    <62>   DW_AT_decl_line   : 1
    <63>   DW_AT_type        : <0x45>
================================

I'd rather see the static variable under the abstract origin DIE,
instead of separate, but at least the subprogram it's in points to the
abstract origin.  If you work hard enough you can tie it all together.

But in 3.9, that abstract_origin link is gone:
================================
 <1><2a>: Abbrev Number: 2 (DW_TAG_subprogram)
 <2><2b>: Abbrev Number: 3 (DW_TAG_variable)
    <2c>   DW_AT_name        : (indirect string, offset: 0x5f): a
    <30>   DW_AT_type        : <0x41>
    <34>   DW_AT_decl_file   : 1
    <35>   DW_AT_decl_line   : 2
    <36>   DW_AT_location    : 9 byte block: 3 0 0 0 0 0 0 0 0     (DW_OP_addr:
0)
================================

Now it's impossible to associate the static variable with the
subprogram where it belongs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161007/3a88bbd1/attachment-0001.html>


More information about the llvm-bugs mailing list