<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 --- - flex scanner results in "Bad machine code: Using an undefined physical register" after r188766"
   href="http://llvm.org/bugs/show_bug.cgi?id=17315">17315</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>flex scanner results in "Bad machine code: Using an undefined physical register" after r188766
          </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>FreeBSD
          </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>dimitry@andric.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=11254" name="attach_11254" title="Testcase for flex scanner "Bad machine code" bug">attachment 11254</a> <a href="attachment.cgi?id=11254&action=edit" title="Testcase for flex scanner "Bad machine code" bug">[details]</a></span>
Testcase for flex scanner "Bad machine code" bug

While attempting to build a recent version of FreeBSD with clang trunk r191105,
I got a few "Bad machine code" errors, in a flex scanner that is generated
during the build process:

*** Bad machine code: Using an undefined physical register ***
- function:    yylex
- basic block: BB#8 sw.bb (0x2a5b0f10)
- instruction: TCRETURNri %vreg32, 0, <regmask>, %ESP<imp-use>,
%ECX<imp-use,kill>; GR32_TC:%vreg32
- operand 4:   %ECX<imp-use,kill>

*** Bad machine code: Using an undefined physical register ***
- function:    yylex
- basic block: BB#11 sw.bb10 (0x2a5ad3ac)
- instruction: TCRETURNri %vreg26, 0, <regmask>, %ESP<imp-use>, %ECX<imp-use>;
GR32_TC:%vreg26
- operand 4:   %ECX<imp-use>
fatal error: error in backend: Found 2 machine code errors.

This error does not occur with the 3.3 release version of clang we are using in
FreeBSD itself.  After reducing the test case to the attached file, I was able
to bisect where the problem started appearing:

<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=188766">http://llvm.org/viewvc/llvm-project?view=revision&revision=188766</a>

To reproduce, compile the attached testcase with:

clang -O2 -fPIC -fstack-protector -c flexbug.c</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>