<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 info for function argument has a wrong span"
   href="http://llvm.org/bugs/show_bug.cgi?id=18866">18866</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Debug info for function argument has a wrong span
          </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>All
          </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>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yuri@tsoft.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>Created <span class=""><a href="attachment.cgi?id=12077" name="attach_12077" title="test case">attachment 12077</a> <a href="attachment.cgi?id=12077&action=edit" title="test case">[details]</a></span>
test case

Please run the script 'run' from the attached test case. Please note the debug
info for the function argument 'xargs' in the file 'x.o.dwarf':
< 2><0x000000c4>      DW_TAG_formal_parameter
                        DW_AT_name                  xargs
                        DW_AT_decl_file             0x00000001
xxxdirxxx/file.xxx
                        DW_AT_decl_line             0x0000026a
                        DW_AT_type                  <0x00000072>
                        DW_AT_location              <loclist with 2 entries
follows>
                        [ 0]<lowpc=0x00000010><highpc=0x0000001f>DW_OP_reg5
                        [ 1]<lowpc=0x0000001f><highpc=0x00000021>DW_OP_breg7+0

This debug info says that the xargs argument is valid in the range from
lowpc=0x00000010 to highpc=0x00000021
However, from the file 'x.o.asm' it is obvious that the function itself has the
range 0x0010-0x004b.

So the debug info is wrong because its range is too narrow. The range of the
argument should be equal to the function range 0x0010-0x004b, like for every
function argument in unoptimized code.

Additionally, I have two notes:
Note 1: The DW_AT_location line above shouldn't even mention any ranges, and
should look like this:
DW_AT_location              DW_OP_reg5
This is because in unoptimized code the range of the argument should be equal
to the function range, and its location is originally defined by the ABI, and
there is no reason why -O0 code should change the argument location at all.

Note 2: Curiously, when in the same case -code-model is set to 'default', the
function range actually becomes 0x0010-0x0021, and the same debug info becomes
valid. This may be a coincidence.


rev.201464 amd64</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>