[llvm-bugs] [Bug 27952] New: licm miscompile with restrict and throw

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 31 13:46:04 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27952

            Bug ID: 27952
           Summary: licm miscompile with restrict and throw
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: eli.friedman at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160531/857d79f6/attachment.html>


More information about the llvm-bugs mailing list