<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 - crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!"' failed.)"
href="https://bugs.llvm.org/show_bug.cgi?id=32587">32587</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>crash at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `isa<X>(Val) && "cast_or_null<Ty>() argument of incompatible type!"' failed.)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chengniansun@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ clang-trunk -v
clang version 5.0.0 (trunk 298510)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang-trunk -O3 small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/Support/Casting.h:251:
typename std::enable_if<(! llvm::is_simple_type<Y>::value), typename
llvm::cast_retty<X, const Y>::ret_type>::type llvm::cast_or_null(const Y&)
[with X = llvm::Instruction; Y = llvm::WeakVH; typename std::enable_if<(!
llvm::is_simple_type<Y>::value), typename llvm::cast_retty<X, const
Y>::ret_type>::type = llvm::Instruction*]: Assertion `isa<X>(Val) &&
"cast_or_null<Ty>() argument of incompatible type!"' failed.
#0 0x0000000001f1cdaa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1f1cdaa)
#1 0x0000000001f1adbe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x1f1adbe)
#2 0x0000000001f1af22 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1f1af22)
#3 0x00007fcefc40a330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fcefb1f8c37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fcefb1fc028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fcefb1f1bf6 __assert_fail_base
/build/eglibc-MjiXCM/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fcefb1f1ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x00000000015fdc6b llvm::AliasSet::aliasesUnknownInst(llvm::Instruction
const*, llvm::AAResults&) const
(/usr/local/clang-trunk/bin/clang-5.0+0x15fdc6b)
#9 0x0000000001600a7a
llvm::AliasSetTracker::findAliasSetForUnknownInst(llvm::Instruction*)
(/usr/local/clang-trunk/bin/clang-5.0+0x1600a7a)
#10 0x0000000001600b36 llvm::AliasSetTracker::addUnknown(llvm::Instruction*)
(/usr/local/clang-trunk/bin/clang-5.0+0x1600b36)
#11 0x00000000016058eb llvm::AliasSetTracker::add(llvm::AliasSetTracker const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x16058eb)
#12 0x0000000001da7a5c (anonymous
namespace)::LoopInvariantCodeMotion::runOnLoop(llvm::Loop*, llvm::AAResults*,
llvm::LoopInfo*, llvm::DominatorTree*, llvm::TargetLibraryInfo*,
llvm::ScalarEvolution*, llvm::OptimizationRemarkEmitter*, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x1da7a5c)
#13 0x0000000001da8bb0 (anonymous
namespace)::LegacyLICMPass::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1da8bb0)
#14 0x00000000016a6ed7 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x16a6ed7)
#15 0x0000000001b04033 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b04033)
#16 0x000000000289a6ff (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x289a6ff)
#17 0x0000000001b04d6f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b04d6f)
#18 0x00000000020ae55a (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x20ae55a)
#19 0x00000000020af843 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x20af843)
#20 0x000000000273868b
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x273868b)
#21 0x0000000002b03b32 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2b03b32)
#22 0x0000000002737d7a clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2737d7a)
#23 0x0000000002413636 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x2413636)
#24 0x00000000023ed936
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x23ed936)
#25 0x000000000249f384
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x249f384)
#26 0x0000000000b30118 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xb30118)
#27 0x0000000000ad0f21 main (/usr/local/clang-trunk/bin/clang-5.0+0xad0f21)
#28 0x00007fcefb1e3f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#29 0x0000000000b2ba09 _start (/usr/local/clang-trunk/bin/clang-5.0+0xb2ba09)
Stack dump:
0. Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/lib/clang/5.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-8/res/20170406-clang-trunk-m32-Weverything-g-O3-build-194037/delta
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-84382d.o -x c small.c
1. <eof> parser at end of file
2. Per-module optimization passes
3. Running pass 'CallGraph Pass Manager' on module 'small.c'.
4. Running pass 'Loop Pass Manager' on function '@main'
5. Running pass 'Loop Invariant Code Motion' on basic block '%for.cond'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 298510)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-5.0: note: diagnostic msg: /tmp/small-1595e4.c
clang-5.0: note: diagnostic msg: /tmp/small-1595e4.sh
clang-5.0: note: diagnostic msg:
********************
$
$ cat small.c
int printf(const char*, ...);
int a, d, e;
short b;
static int c = 1;
int f[1][20];
int fn1(char p1, int p2) {
int g;
while (b) {
g = 0;
for (; g < 2; g++) {
printf("%d", f[c][g]);
printf("%d%d%d\n", c, e, g);
}
p1 |= 8;
}
return p2;
}
int main() {
c = 0;
int h = 6;
short i = 60;
for (;;) {
if (a)
i = 0;
for (; d;) {
i &&(h = 1);
fn1(h, 1);
}
}
}
$</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>