I have a struct array of type
%func_p = type {i8*}
and a global pointer to that struct array
FP_Ptr->dump () : @fp_pointer = external global %func_p*
Now, I want to access the first structure of this array of structures and write data to it. My content is as follows:
Value *FP_Idx = IRB.getInt32(fp_idx); // fp_idx = 0
LoadInst *F_P = IRB.CreateLoad(FP_Pointer);
F_P->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None));
Value *fp_store = IRB.CreateInBoundsGEP(func_p, FP_Pointer, FP_Idx);
But there seems to be a problem with the createinbounds statement:
clang-12: /llvmtest/llvm/lib/IR/Constants.cpp:2396: static llvm::Constant* llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::ArrayRef<llvm::Value*>, bool, llvm::Optional<unsigned int>, llvm::Type*): Assertion `Ty == cast<PointerType>(C->getType()->getScalarType())->getElementType()' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
and I wonder how I can fix it? In my LLVM version, this statement is defined as
Value *CreateInBoundsGEP(Type *Ty, Value *Ptr, Value *Idx)
Value *CreateInBoundsGEP(Type *Ty, Value *Ptr, ArrayRef<Value *> IdxList)
Value *CreateInBoundsGEP(Value *Ptr, ArrayRef<Value *> IdxList)