}
SVal RegionStoreManager::getBindingForElement(Store store,
- const ElementRegion* R) {
+ const ElementRegion* R) {
+ // We do not currently model bindings of the CompoundLiteralregion.
+ const ElementRegion *Tmp = R;
+ while (Tmp) {
+ const MemRegion *Sup = Tmp->getSuperRegion();
+ if (isa<CompoundLiteralRegion>(Sup))
+ return UnknownVal();
+ Tmp = dyn_cast<ElementRegion>(Sup);
+ }
+
// Check if the region has a binding.
RegionBindings B = GetRegionBindings(store);
if (const Optional<SVal> &V = getDirectBinding(B, R))
--- /dev/null
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix -verify %s
+
+int printf(const char *restrict,...);
+
+// Testing core functionality of the region store.
+// radar://10127782
+int compoundLiteralTest() {
+ int index = 0;
+ for (index = 0; index < 2; index++) {
+ int thing = (int []){0, 1}[index];
+ printf("thing: %i\n", thing);
+ }
+ return 0;
+}
+
+int compoundLiteralTest2() {
+ int index = 0;
+ for (index = 0; index < 3; index++) {
+ int thing = (int [][3]){{0,0,0}, {1,1,1}, {2,2,2}}[index][index];
+ printf("thing: %i\n", thing);
+ }
+ return 0;
+}