<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 - __builtin_expect assertion failure ("cast<Ty>() argument of incompatible type!")"
href="https://bugs.llvm.org/show_bug.cgi?id=33346">33346</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__builtin_expect assertion failure ("cast<Ty>() argument of incompatible type!")
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>greg_bedwell@sn.scee.net
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, xinliangli@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Our internal testing spotted a new compile time assertion failure on trunk.
I've included a reduced C++ example that demonstrates the issue.
Using:
clang version 5.0.0 (trunk 304912)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/greg/public_git/./build/bin
$ cat 1.cpp
// ====================================
long foo(long a) { return __builtin_expect(a, a); }
// ====================================
$ ./build/bin/clang -c 1.cpp -O1
clang-5.0: /home/greg/public_git/llvm/include/llvm/Support/Casting.h:254:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
llvm::ConstantInt; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type
= llvm::ConstantInt*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
We've bisected it to r304517 (
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=304517">http://llvm.org/viewvc/llvm-project?view=revision&revision=304517</a> ):
~~
[Profile] Enhance expect lowering to handle correlated branches
builtin_expect applied on && or || expressions were not
handled properly before. With this patch, the problem is fixed.
Differential Revision: <a href="http://reviews.llvm.org/D33164">http://reviews.llvm.org/D33164</a>
~~</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>