<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 --- - Wrong code/bug at -O2 on x86_64-unknown-freebsd11.0"
   href="https://llvm.org/bugs/show_bug.cgi?id=30987">30987</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wrong code/bug at -O2 on x86_64-unknown-freebsd11.0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>m@mikaelsimonsson.com
          </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>Created <span class=""><a href="attachment.cgi?id=17581" name="attach_17581" title="Test case">attachment 17581</a> <a href="attachment.cgi?id=17581&action=edit" title="Test case">[details]</a></span>
Test case

Using latest snapshot of Clang on FreeBSD: 4.0.d20161003

% clang++-devel -v
clang version 4.0.0
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/local/llvm-devel/bin

% clang++39 -v
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/local/llvm39/bin

% clang++-devel -O2 -std=c++1z -stdlib=libc++ b.cc

-O1 or lower works on both versions, -O2 or -O3 does not. Code works on gcc7
with all optimization levels.

Sorry about the large test case, tried to simplify as much as I could.

Expected output:
1

Actual output (or similar):
-121
-120
-119
No match: -121
0</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>