<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 - BPF target: r11 leaks to generated code on array access in a loop using volatile index"
   href="https://bugs.llvm.org/show_bug.cgi?id=39317">39317</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BPF target: r11 leaks to generated code on array access in a loop using volatile index
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.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>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>elazarg@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21010" name="attach_21010" title="zip file with bitcode, llvm-disassembly, bpf-disassembly, object file and source C file">attachment 21010</a> <a href="attachment.cgi?id=21010&action=edit" title="zip file with bitcode, llvm-disassembly, bpf-disassembly, object file and source C file">[details]</a></span>
zip file with bitcode, llvm-disassembly, bpf-disassembly, object file and
source C file

Running on a source code very similar to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - BPF target: segfault on access to a volatile array in a loop"
   href="show_bug.cgi?id=39316">bug #39316</a>, llc emits invalid code
that uses the nonexistent register r1. This register seems to be used for
internal manipulations in the backend, but should not be exposed in the BPF
code.

(The usage also does not make sense because it reads from an uninitialized
register, and then writes to an unused register)

To reproduce, run 

$ llc-6.0 -march=bpf -filetype=obj bug_r11.bc

To see the bug, run 

$ llvm-objdump-6.0 -S bug_r11.o
...
      11:       bf b1 00 00 00 00 00 00         r1 = r11
...
LBB0_3:
      21:       bf 1b 00 00 00 00 00 00         r11 = r1
...</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>