summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
diff options
context:
space:
mode:
authorJim Goodnow II <jim@thegoodnows.net>2011-11-16 20:29:27 +0000
committerJim Goodnow II <jim@thegoodnows.net>2011-11-16 20:29:27 +0000
commit8d21fc8239f648a9abed6e3dfdf88a8854e66d66 (patch)
treefe0fb70c42e1e0405661962f5f83cdc04000758a /clang/lib/StaticAnalyzer/Core/RegionStore.cpp
parent9dc3212f98f1b6605cc5b4af7d047d0a2a1334ce (diff)
downloadbcm5719-llvm-8d21fc8239f648a9abed6e3dfdf88a8854e66d66.tar.gz
bcm5719-llvm-8d21fc8239f648a9abed6e3dfdf88a8854e66d66.zip
Fixed crash with initializer lists and unnamed bitfields in the RegionStore
Manager. Added test to ensure proper binding of initialized values. This patch fixes PR11249. llvm-svn: 144831
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/RegionStore.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
index a207729be05..4ea465ff2e7 100644
--- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1506,11 +1506,15 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R,
RecordDecl::field_iterator FI, FE;
StoreRef newStore(store, *this);
- for (FI = RD->field_begin(), FE = RD->field_end(); FI != FE; ++FI, ++VI) {
+ for (FI = RD->field_begin(), FE = RD->field_end(); FI != FE; ++FI) {
if (VI == VE)
break;
+ // Skip any unnamed bitfields to stay in sync with the initializers.
+ if ((*FI)->isUnnamedBitfield())
+ continue;
+
QualType FTy = (*FI)->getType();
const FieldRegion* FR = MRMgr.getFieldRegion(*FI, R);
@@ -1520,6 +1524,7 @@ StoreRef RegionStoreManager::BindStruct(Store store, const TypedValueRegion* R,
newStore = BindStruct(newStore.getStore(), FR, *VI);
else
newStore = Bind(newStore.getStore(), svalBuilder.makeLoc(FR), *VI);
+ ++VI;
}
// There may be fewer values in the initialize list than the fields of struct.
OpenPOWER on IntegriCloud