[LLVMdev] Cast error
Duncan Sands
baldrick at free.fr
Thu Jan 12 04:52:03 PST 2012
Hi Hripsime,
> I have a trouble with LLVM rev - 147926 cast instructions. Here is my code:
>
> ............
> for(std::vector<Value*>::iterator it = getElementPtrs.begin(); it !=
> getElementPtrs.end(); ++it) {
> Value* current = *it;
> errs() << *current << "\n";
> GetElementPtrInst* gep = cast<GetElementPtrInst>(current);
> assert(gep != NULL && "GetElementPtrInst must be valid!");
> ............
>
> Program crashes with the above mentioned assertion. Here getElementPtrs is a
> vector of Values, that are GetElementPtrInst- s. errs() works fine. I've also
> tried to dyn_cast the value, but it doesn't work too.
> Any ideas?
maybe it's a ConstantExpr getelementptr, rather than a GetElementPtrInst?
Ciao, Duncan.
More information about the llvm-dev
mailing list