[llvm] r175550 - Fix a bug that was found by the clang static analyzer. The var "AT" is null so we cant deref it.

Nadav Rotem nrotem at apple.com
Tue Feb 19 11:36:59 PST 2013


Author: nadav
Date: Tue Feb 19 13:36:59 2013
New Revision: 175550

URL: http://llvm.org/viewvc/llvm-project?rev=175550&view=rev
Log:
Fix a bug that was found by the clang static analyzer. The var "AT" is null so we cant deref it.

Modified:
    llvm/trunk/lib/IR/ConstantFold.cpp

Modified: llvm/trunk/lib/IR/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/ConstantFold.cpp?rev=175550&r1=175549&r2=175550&view=diff
==============================================================================
--- llvm/trunk/lib/IR/ConstantFold.cpp (original)
+++ llvm/trunk/lib/IR/ConstantFold.cpp Tue Feb 19 13:36:59 2013
@@ -846,8 +846,8 @@ Constant *llvm::ConstantFoldInsertValueI
   else if (ArrayType *AT = dyn_cast<ArrayType>(Agg->getType()))
     NumElts = AT->getNumElements();
   else
-    NumElts = AT->getVectorNumElements();
-  
+    NumElts = Agg->getType()->getVectorNumElements();
+
   SmallVector<Constant*, 32> Result;
   for (unsigned i = 0; i != NumElts; ++i) {
     Constant *C = Agg->getAggregateElement(i);





More information about the llvm-commits mailing list