<html>
    <head>
      <base href="http://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 --- - .debug_ranges section is broken"
   href="http://llvm.org/bugs/show_bug.cgi?id=19563">19563</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>.debug_ranges section is broken
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>samsonov@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dblaikie@gmail.com, echristo@gmail.com, eugeni.stepanov@gmail.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat tmp/symbolizer/a.cc
#include <stdio.h>

void f() {
  int * volatile p = new int;
  if (*p)
    printf("zzz\n");
}

int main(void) {
  f();
  return 0;
}

$ ./bin/clang++ -O2 -g -fsanitize=memory tmp/symbolizer/a.cc

$ readelf -wi a.out
<...>
 <1><104a1a>: Abbrev Number: 5 (DW_TAG_subprogram)
    <104a1b>   DW_AT_name        : (indirect string, offset: 0x352bf): main     
    <104a1f>   DW_AT_decl_file   : 1    
    <104a20>   DW_AT_decl_line   : 9    
    <104a21>   DW_AT_type        : <0x104a4f>   
    <104a25>   DW_AT_external    : 1    
    <104a25>   DW_AT_accessibility: 1   (public)
    <104a26>   DW_AT_low_pc      : 0x86570      
    <104a2e>   DW_AT_high_pc     : 0xb4 
    <104a32>   DW_AT_frame_base  : 1 byte block: 57     (DW_OP_reg7 (rsp))
    <104a34>   Unknown AT value: 3fe7: 1        
 <2><104a34>: Abbrev Number: 6 (DW_TAG_inlined_subroutine)
    <104a35>   DW_AT_abstract_origin: <0x1049ea>        
    <104a39>   DW_AT_ranges      : 0x5de90      
    <104a3d>   DW_AT_call_file   : 1    
    <104a3e>   DW_AT_call_line   : 10

$ readelf -wR a.out
<...>
    0005de90 000000000010ca46 000000000010cac4 
    0005de90 000000000010cada 000000000010cae4 
    0005de90 <End of list>

Address ranges for inlined subroutine in .debug_ranges are wrong.
The addresses in range list from .debug_ranges should be relative to
the base address (DW_AT_low_pc) of compilation unit that refers this range
list. In this example the addresses written in the binary are absolute. If I
subtract base address of an a.cc CU (0x864c0) from these addresses, range lists
become correct.

I haven't found a revision which broke this yet. Working on that.</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>