GCC fails to understand that NextBB is always initialized if EvaluateBlock
authorDuncan Sands <baldrick@free.fr>
Thu, 23 Feb 2012 08:23:06 +0000 (08:23 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 23 Feb 2012 08:23:06 +0000 (08:23 +0000)
returns 'true' and emits a warning.  Help it out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151242 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp

index 7c78a2054487709e132c684e4c6907430b47dbbb..acb723e1cc894bb83684f3469b3f00ecc5d4d306 100644 (file)
@@ -2645,7 +2645,7 @@ bool Evaluator::EvaluateFunction(Function *F, Constant *&RetVal,
   BasicBlock::iterator CurInst = CurBB->begin();
 
   while (1) {
-    BasicBlock *NextBB;
+    BasicBlock *NextBB = 0; // Initialized to avoid compiler warnings.
     if (!EvaluateBlock(CurInst, NextBB))
       return false;