Hi all,
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?
Sincerely,
Hripsime.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120112/091bc578/attachment.html>
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.