<div dir="ltr"><div>Hello,</div><div><br></div><div>My code: (CallInst *CI, IRBuilder<> &B)</div><div><br></div><div>    SmallVector<Value *, 8> args;</div><div>    Value *v = B.CreateGlobalString("hi", "str");</div><div>    args.push_back(v);</div><div>    </div><div>    SmallVector<Type*, 8> params;</div><div>    params.push_back(v->getType());</div><div><br></div><div>    Module *M = B.GetInsertBlock()->getParent()->getParent();  </div><div><br></div><div><br></div><div>    FunctionType *printfType = FunctionType::get(B.getInt32Ty(), params, true);</div><div>    Constant* const_printf = M->getOrInsertFunction("printf", printfType);</div><div>    Function *F = cast<Function>(const_printf);</div><div>    F->dump();</div><div>    CallInst * opInst = B.CreateCall(F, args, "call");</div><div><br></div><div><br></div><div>It crashes with:</div><div>void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.</div><div><br></div><div>Any advices how to fix it? Thanks</div></div>