[cfe-commits] r70867 - /cfe/trunk/lib/Analysis/BasicStore.cpp
Ted Kremenek
kremenek at apple.com
Mon May 4 08:25:46 PDT 2009
Author: kremenek
Date: Mon May 4 10:25:46 2009
New Revision: 70867
URL: http://llvm.org/viewvc/llvm-project?rev=70867&view=rev
Log:
Add array index assertion: BasicStore should not expect any fancy
ElementRegions that have non-zero array indices.
Modified:
cfe/trunk/lib/Analysis/BasicStore.cpp
Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=70867&r1=70866&r2=70867&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Mon May 4 10:25:46 2009
@@ -212,11 +212,14 @@
case loc::MemRegionKind: {
const MemRegion *R = cast<loc::MemRegionVal>(BaseL).getRegion();
- if (isa<ElementRegion>(R)) {
+ if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
// int x;
// char* y = (char*) &x;
// 'y' => ElementRegion(0, VarRegion('x'))
// y[0] = 'a';
+ assert(ER->getIndex().isUnknown() ||
+ cast<nonloc::ConcreteInt>(ER->getIndex()).getValue() == 0);
+ ER = ER; // silence 'unused' warning in release modes.
return Base;
}
More information about the cfe-commits
mailing list