[LLVMdev] null pointer check missing in LoopInfo
Sameer D. Sahasrabuddhe
sameerds at it.iitb.ac.in
Wed Jun 29 05:42:56 PDT 2005
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.
More information about the llvm-dev
mailing list