<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 --- - PowerPC64: CR spill code causes SEGV"
   href="https://llvm.org/bugs/show_bug.cgi?id=26500">26500</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>PowerPC64: CR spill code causes SEGV
          </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>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anton@samba.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I've seen a few SEGVs when running csmith. In all the cases I have looked at,
we've dereferenced what looks like a condition register value:

One example:

r3             0x42000042

=> 0x0000000010000bdc <+1516>:    lhz     r3,30996(r3)

What is interesting is that the CR spill gets scheduled quite a way into the
function, after we've used r12 for something else. Later on we reuse r12 (which
has now been contaminated with a CR).


Use r12:
    10000734:   ff ff 82 3d     addis   r12,r2,-1

Spill CR using r12 as scratch:
    100007fc:   26 00 80 7d     mfcr    r12
    1000080c:   08 00 81 91     stw     r12,8(r1)

Use value in r12 later on:
    10000914:   a8 00 9f f9     std     r12,168(r31)
    10000bcc:   a8 00 7f e8     ld      r3,168(r31)


LLVM seems to use r12 unconditionally for CR spill, are we missing some sort of
r12 clobber?</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>