cdisselkoen / llvm-ir

LLVM IR in natural Rust data structures
MIT License
550 stars 46 forks source link

Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type! #16

Open kazuki-hanai opened 2 years ago

kazuki-hanai commented 2 years ago

I got these error when cargo run

Error message

rust-llvm-ir-test: llvm-project/llvm/include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GetElementPtrInst; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GetElementPtrInst*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
zsh: abort (core dumped)  cargo run

Debug Log

Creating a Module from path "./irs/client.bc"
Created a MemoryBuffer
Parsed bitcode to llvm_sys module
Creating a Module from an LLVMModuleRef
Processing func "__traceiter_9p_client_req"
unknown enum param attr 41
Collected info on 4 parameters
Collected names of 7 basic blocks
Collected names of 16 values
Processing a basic block named Name("entry")
Processing instruction "  call void @__sanitizer_cov_trace_pc() #14"
Processing instruction "  %0 = load volatile %struct.tracepoint_func*, %struct.tracepoint_func** getelementptr inbounds ({ i8*, { %struct.atomic_t, { %struct.device_dma_parameters* } }, %struct.static_call_key*, i8*, i8*, i32 ()*, void ()*, %struct.tracepoint_func* }, { i8*, { %struct.atomic_t, { %struct.device_dma_parameters* } }, %struct.static_call_key*, i8*, i8*, i32 ()*, void ()*, %struct.tracepoint_func* }* @__tracepoint_9p_client_req, i64 0, i32 7), align 8"
rust-llvm-ir-test: llvm-project/llvm/include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GetElementPtrInst; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GetElementPtrInst*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
zsh: abort (core dumped)  cargo run

Source code image

kazuki-hanai commented 2 years ago

Do you know why this error happend and solutions?