On Thu, 28 Nov 2002, Chris Lattner wrote:> > > The following function produces a segv when the begin() is taken from > > vmap, the ScalarMap... > > int count = 0; > > std::map<Value*, DSNodeHandle>& vmap = theGraph->getScalarMap(); > > Are you sure "theGraph" is not null at this point?yes... that call returns sucessfully. the segfault occurs after...> > -Chris > > > for (std::map<Value*, DSNodeHandle>::iterator i = vmap.begin(); i > > != vmap.end(); ++i) { > > if(i->second.getNode() == theNode) { > > if(isa<MallocInst>(i->first)) count++; > > } > > } > > if(count == 1) return true; > > return false; > > } > > > > This code used to work... Has something changed or is our code wrong? I > > rebuilt two days ago... > > > > Dave > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > -Chris > >
> > > The following function produces a segv when the begin() is taken from > > > vmap, the ScalarMap... > > > int count = 0; > > > std::map<Value*, DSNodeHandle>& vmap = theGraph->getScalarMap(); > > > > Are you sure "theGraph" is not null at this point? > yes... that call returns sucessfully. the segfault occurs after...I don't doubt the call successfully returns. The call basically does some pointer arithmetic, adding a small constant to "theGraph". When you dereference vmap later, you are loading this. If theGraph is null going into the call you won't get a segfault there, you will get it later. So are you _sure_ theGraph is not null? -Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Turns out my CVS build was really old, and just needed to be rebuilt from scratch... I was pretty sure of the non-nullness, and everything seems to work now... Dave On Thu, 28 Nov 2002, Chris Lattner wrote:> > > > The following function produces a segv when the begin() is taken from > > > > vmap, the ScalarMap... > > > > int count = 0; > > > > std::map<Value*, DSNodeHandle>& vmap = theGraph->getScalarMap(); > > > > > > Are you sure "theGraph" is not null at this point? > > yes... that call returns sucessfully. the segfault occurs after... > > I don't doubt the call successfully returns. The call basically does some > pointer arithmetic, adding a small constant to "theGraph". When you > dereference vmap later, you are loading this. If theGraph is null going > into the call you won't get a segfault there, you will get it later. So > are you _sure_ theGraph is not null? > > -Chris > >