Add an assertion to catch attempts to access off the end of the array.

Based on a patch by Javier Martinez.

llvm-svn: 103391
This commit is contained in:
Duncan Sands 2010-05-10 04:54:28 +00:00
parent abfb58d1d2
commit e4d6670f6b
1 changed files with 2 additions and 0 deletions

View File

@ -5428,6 +5428,8 @@ const EVT *SDNode::getValueTypeList(EVT VT) {
sys::SmartScopedLock<true> Lock(*VTMutex); sys::SmartScopedLock<true> Lock(*VTMutex);
return &(*EVTs->insert(VT).first); return &(*EVTs->insert(VT).first);
} else { } else {
assert(VT.getSimpleVT().SimpleTy < MVT::LAST_VALUETYPE &&
"Value type out of range!");
return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy]; return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy];
} }
} }