From: Chris Lattner Date: Wed, 24 Sep 2003 23:42:58 +0000 (+0000) Subject: DOn't crash if program calls the null pointer X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fbc2d84ce9c3ff97a1644b864a2057f8d02179ab;p=oota-llvm.git DOn't crash if program calls the null pointer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8708 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index dbf182d98c1..64e6088e7c6 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -443,8 +443,14 @@ void GraphBuilder::visitCallSite(CallSite CS) { RetVal = getValueDest(*I); DSNode *Callee = 0; - if (DisableDirectCallOpt || !isa(CS.getCalledValue())) + if (DisableDirectCallOpt || !isa(CS.getCalledValue())) { Callee = getValueDest(*CS.getCalledValue()).getNode(); + if (Callee == 0) { + std::cerr << "WARNING: Program is calling through a null pointer?\n" + << *I; + return; // Calling a null pointer? + } + } std::vector Args; Args.reserve(CS.arg_end()-CS.arg_begin());