<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 - After r343028, Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file include/llvm/Support/Casting.h, line 255."
   href="https://bugs.llvm.org/show_bug.cgi?id=41117">41117</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After r343028, Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file include/llvm/Support/Casting.h, line 255.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As described in <a href="https://bugs.freebsd.org/236566">https://bugs.freebsd.org/236566</a>, compiling the FreeBSD
java/openjdk8 port for armv7 or aarch64 asserts with:

Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file include/llvm/Support/Casting.h, line 255.

Bisection shows this started occurring after <a href="https://reviews.llvm.org/rL343028">https://reviews.llvm.org/rL343028</a>
("[LV][LAA] Vectorize loop invariant values stored into loop invariant
address").

Minimized test case:

// clang -cc1 -triple aarch64-- -S -fno-delete-null-pointer-checks -O2
-vectorize-loops instanceKlass-min.cpp
void *a;
struct d {
  template <class c> c *g(int) const;
};
struct i {
  int e;
  template <class c> void f(c *);
};
struct l {
  int count() { return h; }
  int h;
};
int j;
template <class c> c *d::g(int) const {
  a = &((char *)0)[j];
  return (c *)a;
}
template <class c> void i::f(c *) { e = 0; }
d k;
void p() {
  i *b = 0;
  l *m = 0;
  l n;
  while (m < &n) {
    unsigned *o(k.g<unsigned>(0));
    unsigned *c = o + m->count();
    while (o < c) {
      b->f(o);
      ++o;
    }
    ++m;
  }
}</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>