This was checking the wrong GEP expression. Fixing this fixes a gccas crash
authorChris Lattner <sabre@nondot.org>
Thu, 17 Nov 2005 19:35:42 +0000 (19:35 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 17 Nov 2005 19:35:42 +0000 (19:35 +0000)
compiling mysql reported by Ted Kremenek.

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

lib/Transforms/Scalar/IndVarSimplify.cpp

index f2b812d437d1144b14d74876bb20707e49f14f64..bf735aff9eadb0621c688a9003113235f409f77a 100644 (file)
@@ -162,7 +162,7 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
           if (CE->getOperand(NumOps-1)->isNullValue()) {
             // Check to make sure the last index really is an array index.
             gep_type_iterator GTI = gep_type_begin(GEPI);
-            for (unsigned i = 1, e = GEPI->getNumOperands()-1;
+            for (unsigned i = 1, e = CE->getNumOperands()-1;
                  i != e; ++i, ++GTI)
               /*empty*/;
             if (isa<SequentialType>(*GTI)) {