<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Intruction incorrectly marked as not mappable back to source code"
   href="https://bugs.llvm.org/show_bug.cgi?id=47781">47781</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Intruction incorrectly marked as not mappable back to source code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </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>enhancement
          </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>wcohen@redhat.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When reviewing the binaries of programs build with clang-10.0.1-2.fc32.x86_64
on fedora 32 with "eu-readelf --debug-dump=decodedline" I found that clang
appeared to incorrectly state that one of the instructions in the executable
could not be mapped back to the source code.  This can be observed build a
small rpm package on Fedora 32.  

Get the heapsort-0.5-fc32.src.rpm from
<a href="https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps">https://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps</a> .
Then following the steps below to build the binary:

sudo dnf build-dep ./heapsort-0.5-fc32.src.rpm
rpm -Uvh heapsort-0.5-fc32.src.rpm
cd ~/rpmbuild/SPECS
export CC=clang
export CXX=clang++
rpmbuild --define '%optflags  -O2 -g  -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fcf-protection -Wno-narrowing
-Wno-unused-command-line-argument' -bc heapsort.spec

The issue can be seen in the resulting heapsort binary:

cd ~/rpmbuild/BUILD/heapsort-0.5
eu-readelf --debug-dump=decodedline ./heapsort

The output of eu-readelf has:

     0:14           0   0  0 0x0000000000401202 <main+0x42>

Looking at the dissembly of the code produced with "objdump -d
heapsort" this instruction is a zeroing of the register used for the
variable of i:

  401202:       31 db                   xor    %ebx,%ebx

Would expect that the eu-readelf output be (the "i=0" in the source code):

     97:9           0   0  0 0x0000000000401202 <main+0x42></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>