<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 --- - licm miscompile with restrict and throw"
   href="https://llvm.org/bugs/show_bug.cgi?id=27952">27952</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>licm miscompile with restrict and throw
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eli.friedman@gmail.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>Testcase:

#include <stdlib.h>

void t() { throw 0; }
void (*tt)() = t;
void f(int*__restrict a, int x, bool y) {
  for (int i = 0; i < x; ++i) {
    *a += 1;
    if (y) tt();
  }
}
void (*ff)(int*__restrict,int,bool) = f;
int main() {
  int a = 0;
  try {
    ff(&a, 10, true);
  } catch (...) {
    if (a != 1) abort();
  }
}

Runs to completion with clang -O0, aborts with clang -O2.

The problem is incomplete safety checks in LICM.

(Artificial testcase.)</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>