<html>
    <head>
      <base href="http://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 - Compiling a math-heavy file that uses Eigen with the '-O3 -ffast-math' causes an infinite hang"
   href="http://bugs.llvm.org/show_bug.cgi?id=32514">32514</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiling a math-heavy file that uses Eigen with the '-O3 -ffast-math' causes an infinite hang
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>compiler-rt
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rsanchez.saez@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=18215" name="attach_18215" title="clang hang example">attachment 18215</a> <a href="attachment.cgi?id=18215&action=edit" title="clang hang example">[details]</a></span>
clang hang example

Compiling a math-heavy file that uses Eigen with the '-O3 -ffast-math' makes
the clang compiler to hang indefinitely.

The attached file shows the problem. It is a rework of: 

<a href="https://github.com/sweeneychris/TheiaSfM/blob/98d1b2c07f836a6f90046ef5e60edea4be25a94b/src/theia/sfm/pose/perspective_three_point.cc#L184">https://github.com/sweeneychris/TheiaSfM/blob/98d1b2c07f836a6f90046ef5e60edea4be25a94b/src/theia/sfm/pose/perspective_three_point.cc#L184</a>

to be self-compilable. It only depends on eigen3, you can install it through
MacPorts: sudo port install eigen3.

Compile the file through

clang -O3 -ffast-math -c PnP.cpp -I/opt/local/include/eigen3

and observe clang to hang indefinitely.

Compilation using 

clang -O3 -c PnP.cpp -I/opt/local/include/eigen3

succeeds.

--$ clang --version
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin</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>