<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 - Miscompile with collapse(4) on a triangular loop nest"
   href="https://bugs.llvm.org/show_bug.cgi?id=47221">47221</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Miscompile with collapse(4) on a triangular loop nest
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Clang Compiler Support
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>huberjn@ornl.gov
          </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=23859" name="attach_23859" title="Makefile and test code used on x86-64 Linux with clang trunk to produce the error.">attachment 23859</a> <a href="attachment.cgi?id=23859&action=edit" title="Makefile and test code used on x86-64 Linux with clang trunk to produce the error.">[details]</a></span>
Makefile and test code used on x86-64 Linux with clang trunk to produce the
error.

The following triangular loop nest miscompiles on trunk when attempting to
collapse the whole loop nest. Device code is not generated causing `undefined
reference to` errors in the device linker.

<a href="https://godbolt.org/z/1xv6Eo">https://godbolt.org/z/1xv6Eo</a>

Using collapse(3) on the outer loop, the program compiles without errors but
miscompiles and returns incorrect values. Collapsing with < 3 works as expected
as does collapsing on the second loop instead.</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>