<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 --- - Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor"
   href="http://llvm.org/bugs/show_bug.cgi?id=21903">21903</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bad machine code: MBB exits via unconditional fall-through but its successor differs from its CFG successor
          </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>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>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=13534" name="attach_13534" title="Test case, minimized from Inkscape's geom.cpp">attachment 13534</a> <a href="attachment.cgi?id=13534&action=edit" title="Test case, minimized from Inkscape's geom.cpp">[details]</a></span>
Test case, minimized from Inkscape's geom.cpp

I received a report from the maintainer of the FreeBSD inkscape port, about
clang giving a lot of "Bad machine code" messages when compiling a certain
source file in this program:

<a href="http://beefy1.isc.freebsd.org/data/head-i386-default/2014-12-12_10h09m09s/logs/inkscape-0.48.5_1.log">http://beefy1.isc.freebsd.org/data/head-i386-default/2014-12-12_10h09m09s/logs/inkscape-0.48.5_1.log</a>

The errors are as follows:

*** Bad machine code: MBB exits via conditional branch/fall-through but the CFG
successors don't match the actual successors! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#6 if.end3 (0x2d17a3f0)

*** Bad machine code: MBB exits via unconditional fall-through but its
successor differs from its CFG successor! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#18 (null) (0x2d29287c)

*** Bad machine code: MBB exits via unconditional fall-through but its
successor differs from its CFG successor! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#19 (null) (0x2d2928d8)

*** Bad machine code: MBB exits via conditional branch/fall-through but the CFG
successors don't match the actual successors! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#9 if.end.i34 (0x2d1d3e38)

*** Bad machine code: Using an undefined physical register ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#10 if.else.i43 (0x2d17a4a8)
- instruction: FNSTSW16r %AX<imp-def>, %FPSW<imp-use,kill>
- operand 1:   %FPSW<imp-use,kill>

This crash occurs both with clang 3.4.1 (current in FreeBSD 9.x through 11.x),
and 3.5.0 (which is coming up in FreeBSD 11.x).  When I tried with clang trunk
r223525, it spun at 100% CPU, until I killed it after 10 minutes or so (but it
didn't use a lot of memory).

I have reduced the test case to the attached file, which can be compiled with:

clang -cc1 -triple i386-unknown-linux -S -mrelocation-model static -target-cpu
i486 -O2 inkscape-geom-reduced.cpp

resulting in:

*** Bad machine code: MBB exits via unconditional fall-through but its
successor differs from its CFG successor! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#9 (null) (0x2add140c)

*** Bad machine code: MBB exits via conditional branch/fall-through but the CFG
successors don't match the actual successors! ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#2 if.end.i (0x2add7488)

*** Bad machine code: Using an undefined physical register ***
- function:    _ZN4Geom23line_segment_intersectpERKNS_5PointES2_S2_S2_
- basic block: BB#3 if.end10.i (0x2adb7334)
- instruction: FNSTSW16r %AX<imp-def>, %FPSW<imp-use>
- operand 1:   %FPSW<imp-use>
fatal error: error in backend: Found 3 machine code errors.

These errors show for -target-cpu values of i486, i586 and i686, but as far as
I can determine, they disappear when using pentium2 or 'higher'.</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>