<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 --- - clang hangs with -O"
   href="http://llvm.org/bugs/show_bug.cgi?id=20370">20370</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang hangs with -O
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>chocolate_police@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, 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=12795" name="attach_12795" title="Clang will hang while this file with -O2">attachment 12795</a> <a href="attachment.cgi?id=12795&action=edit" title="Clang will hang while this file with -O2">[details]</a></span>
Clang will hang while this file with -O2

Compiling the attached .cpp file causes clang to hang when using -O2 and above
(at least 8 minutes on my machine). It could be related to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang hangs with -O1 on switches"
   href="show_bug.cgi?id=18898">bug 18898</a> since the
file contains switch statements, but this file is very small in comparison with
only 42 cases (vs. tens of thousands). I tried to reduce the code as much as I
could, but if I remove any more, the file compiles fine in no time at all.

<span class="quote">> clang --version</span >
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Command to cause the hang:
clang -Wall -c -O2 optimizerhang.cpp</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>