--- lib/Transforms/Scalar/InstructionCombining.cpp	17 Sep 2002 07:25:16 -0000	1.3
+++ lib/Transforms/Scalar/InstructionCombining.cpp	17 Sep 2002 14:37:14 -0000
@@ -671,7 +671,10 @@
 
     } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy)) { 
       // Otherwise we can do the fold if the first index of the GEP is a zero
-      Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end());
+      if(Src->idx_begin() != Src->idx_end())
+	Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end());
+      else
+	Indices.insert(Indices.end(), Constant::getNullValue(Type::LongTy));
       Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end());
     }
 
