<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Orphaned DWARF for static local of inlined func"
   href="https://llvm.org/bugs/show_bug.cgi?id=30637">30637</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Orphaned DWARF for static local of inlined func
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>paul_robinson@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>