Sameer D. Sahasrabuddhe
2005-Jun-29 12:42 UTC
[LLVMdev] null pointer check missing in LoopInfo
In LLVM 1.5, the function isLoopHeader fails to check for a null pointer after calling getLoopFor. Dunno if this is fixed in CVS, but attaching a patch anyway ... Sameer. -- Research Scholar, KReSIT, IIT Bombay http://www.it.iitb.ac.in/~sameerds/ -------------- next part -------------- --- LoopInfo.h 2005-06-29 17:42:43.000000000 +0530 +++ llvm/include/llvm/Analysis/LoopInfo.h 2005-06-29 17:59:35.000000000 +0530 @@ -250,7 +250,8 @@ // isLoopHeader - True if the block is a loop header node bool isLoopHeader(BasicBlock *BB) const { - return getLoopFor(BB)->getHeader() == BB; + const Loop *L = getLoopFor(BB); + return L ? L->getHeader() == BB : false; } /// runOnFunction - Calculate the natural loop information.
On Wed, 29 Jun 2005, Sameer D. Sahasrabuddhe wrote:> In LLVM 1.5, the function isLoopHeader fails to check for a null > pointer after calling getLoopFor. Dunno if this is fixed in CVS, but > attaching a patch anyway ...Thanks, applied: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050627/026861.html -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/