<html>
    <head>
      <base href="https://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 - Loop miscompile"
   href="https://bugs.llvm.org/show_bug.cgi?id=37823">37823</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Loop miscompile
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ks@claylabs.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=20434" name="attach_20434" title="Program to trigger bug in Clang">attachment 20434</a> <a href="attachment.cgi?id=20434&action=edit" title="Program to trigger bug in Clang">[details]</a></span>
Program to trigger bug in Clang

I've attached a relatively simple program that triggers a miscompile. The
program logic should be straight-forward. I'm fairly certain there is no
undefined behavior.

When compiling with -O2 or -O3, the wrong output is produced. The generated
program also triggers an error with valgrind.

When compiling the attached program with -O0, the correct output is produced,
and there are no errors with valgrind.

I've tested with LLVM 6.0 and also with Xcode 9.4.1. The OS is High Sierra.</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>