<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 --- - Nested static vars in same DWARF scope"
   href="https://llvm.org/bugs/show_bug.cgi?id=23164">23164</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Nested static vars in same DWARF scope
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>Common Code Generator Code
          </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>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If you have two static variables with the same name in nested lexical blocks:

int main() {
  static float a = 50;
  int b = a;
  {
    static int a = 200;
    b += a;
  }
  return b;
}

You'll find that both DIEs for the two "a" variables are siblings.

 <2><43>: Abbrev Number: 3 (DW_TAG_variable)
    <44>   DW_AT_name        : (indirect string, offset: 0x54): a    
    <48>   DW_AT_type        : <0x7c>    
    <4c>   DW_AT_decl_file   : 1    
    <4d>   DW_AT_decl_line   : 2    
    <4e>   DW_AT_location    : 9 byte block: 3 0 0 0 0 0 0 0 0     (DW_OP_addr:
0)
 <2><58>: Abbrev Number: 3 (DW_TAG_variable)
    <59>   DW_AT_name        : (indirect string, offset: 0x54): a    
    <5d>   DW_AT_type        : <0x83>    
    <61>   DW_AT_decl_file   : 1    
    <62>   DW_AT_decl_line   : 5    
    <63>   DW_AT_location    : 9 byte block: 3 4 0 0 0 0 0 0 0     (DW_OP_addr:
4)

There's a lexical_block missing.</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>