Claang bug

include/llvm/Support/Casting.h:194: typename cast_retty<Instruction, Value >::ret_type llvm::cast(llvm::Value const &): Assertion `isa(Val) && “cast() argument of incompatible type!”’ failed.
0 clang 0x00000000019867cf
1 clang 0x0000000001986ce9
2 libpthread.so.0 0x00007f6921e2f060
3 libc.so.6 0x00007f69211113a5 gsignal + 53
4 libc.so.6 0x00007f6921114b0b abort + 379
5 libc.so.6 0x00007f6921109d4d __assert_fail + 221
6 clang 0x000000000169e48e
7 clang 0x00000000018f1f7f llvm::FPPassManager::runOnFunction(llvm::Function&) + 351
8 clang 0x00000000018f226b llvm::FPPassManager::runOnModule(llvm::Module&) + 75
9 clang 0x00000000018f23bb llvm::MPPassManager::runOnModule(llvm::Module&) + 283
10 clang 0x00000000018f2981 llvm::PassManagerImpl::run(llvm::Module&) + 289
11 clang 0x00000000018f2e9a llvm::PassManager::run(llvm::Module&) + 10
12 clang 0x00000000007ccb3e clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module
, clang::BackendAction, llvm::raw_ostream
) + 4798
13 clang 0x00000000007cb077 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 263
14 clang 0x00000000008d7d19 clang::ParseAST(clang::Sema&, bool) + 441
15 clang 0x00000000007ca571 clang::CodeGenAction::ExecuteAction() + 769
16 clang 0x00000000006ab177 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 967
17 clang 0x0000000000695b30 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2848
18 clang 0x000000000068d932 cc1_main(char const**, char const**, char const*, void*) + 5650
19 clang 0x0000000000691dd5 main + 757
20 libc.so.6 0x00007f69210fc30d __libc_start_main + 237
21 clang 0x000000000068c25d
Stack dump:
0. Program arguments: /home/artyom/llvm-3.0/build/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name sqlite3.c -mrelocation-model static -flattening -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.53.20110810 -momit-leaf-frame-pointer -coverage-file sqlite3.bc -resource-dir /home/artyom/llvm-3.0/build/bin/…/lib/clang/3.0 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /home/artyom/llvm-3.0/build/bin/…/lib/clang/3.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include -ferror-limit 19 -fmessage-length 168 -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o sqlite3.bc -x c sqlite3.c

  1. parser at end of file
  2. Per-module optimization passes
  3. Running pass ‘Function Pass Manager’ on module ‘sqlite3.c’.
  4. Running pass ‘Flattening control flow’ on function ‘@sqlite3VdbeExec
    clang: error: unable to execute command: Aborted
    clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
    clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information.
    clang: note: diagnostic msg: Preprocessed source(s) are located at:
    clang: note: diagnostic msg: /tmp/sqlite3-8WsrrL.i

Hi Artyom, please open a bugreport as suggested by clang:

... snipped ...

clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/
and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/sqlite3-8WsrrL.i

Ciao, Duncan.

Duncan,

Hi Artyom, please open a bugreport as suggested by clang:
From the stack trace it's clear that the crash is located in some 3-rd

party pass:
"3. Running pass 'Function Pass Manager' on module 'sqlite3.c'.
4. Running pass 'Flattening control flow' on function '@sqlite3VdbeExec'"

So, it's a bug of user / pass, and neither clang nor llvm.