<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 - opt crashes with "opt -mem2reg -early-cse-memssa": Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed"
href="https://bugs.llvm.org/show_bug.cgi?id=33412">33412</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>opt crashes with "opt -mem2reg -early-cse-memssa": Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed
</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>All
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>su@cs.ucdavis.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ clang -v
clang version 5.0.0 (trunk 305165) (llvm/trunk 305163)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm -o small.bc small.c
$ opt -mem2reg -early-cse-memssa -o small-opt.bc small.bc
opt: /tmp/llvm-builder/llvm-source-trunk/include/llvm/Support/Casting.h:248:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(Y&) [with X =
llvm::MemoryAccess; Y = llvm::Use; typename llvm::cast_retty<To,
From>::ret_type = llvm::MemoryAccess*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
#0 0x0000000001e7ef0a (opt+0x1e7ef0a)
#1 0x0000000001e7cc7e (opt+0x1e7cc7e)
#2 0x0000000001e7cdf2 (opt+0x1e7cdf2)
#3 0x00007f9f1d26a390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f9f1bfdd428 gsignal
/build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f9f1bfdf02a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f9f1bfd5bd7 __assert_fail_base
/build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
#7 0x00007f9f1bfd5c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x000000000236caa0 (opt+0x236caa0)
#9 0x0000000001c4505c (opt+0x1c4505c)
#10 0x0000000001c498fe (opt+0x1c498fe)
#11 0x0000000001c4a1c4 (opt+0x1c4a1c4)
#12 0x0000000001c4b25e (opt+0x1c4b25e)
#13 0x000000000197cf83 (opt+0x197cf83)
#14 0x000000000197d04c (opt+0x197d04c)
#15 0x000000000197caed (opt+0x197caed)
#16 0x00000000007aeeec (opt+0x7aeeec)
#17 0x00007f9f1bfc8830 __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#18 0x0000000000819459 (opt+0x819459)
Stack dump:
0. Program arguments: opt -mem2reg -early-cse-memssa -o small-opt.bc
small.bc
1. Running pass 'Function Pass Manager' on module 'small.bc'.
2. Running pass 'Early CSE w/ MemorySSA' on function '@fn1'
Aborted (core dumped)
$
-------------------------------
int a;
void fn1 ()
{
while (1)
{
short c = 1;
if (c)
break;
a = a;
if (a)
continue;
}
}
int main ()
{
fn1 ();
return 0;
}</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>