From e4d6670f6bed2d933664eff37e4dc73c0fa7c933 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 10 May 2010 04:54:28 +0000 Subject: [PATCH] Add an assertion to catch attempts to access off the end of the array. Based on a patch by Javier Martinez. llvm-svn: 103391 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index e9de6d56f9ac..000cdb44ff5e 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5428,6 +5428,8 @@ const EVT *SDNode::getValueTypeList(EVT VT) { sys::SmartScopedLock Lock(*VTMutex); return &(*EVTs->insert(VT).first); } else { + assert(VT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE && + "Value type out of range!"); return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy]; } }