I'm thinking about the whole logic below. Does it make sense to try to get the direct binding of the super region of an element region? <br><br>I can only think of one case:<br><br>int x = 1; <br>char *y = &x;<br>y[2];<br>
<br>But this case only triggers 'return UnknownVal();' in the last. What cases does the 3 'if' above deal with?<br><br>RegionStore.cpp:1177<br><br> // Check if the immediate super region has a direct binding.<br>
if (const Optional<SVal> &V = getDirectBinding(B, superR)) {<br> if (SymbolRef parentSym = V->getAsSymbol()) {<br> return ValMgr.getDerivedRegionValueSymbolVal(parentSym, R);<br> }<br><br> if (V->isUnknownOrUndef())<br>
return *V;<br><br> // Handle LazyCompoundVals for the immediate super region. Other cases<br> // are handled in 'RetrieveFieldOrElementCommon'.<br> if (const nonloc::LazyCompoundVal *LCV =<br> dyn_cast<nonloc::LazyCompoundVal>(V)) {<br>
R = MRMgr.getElementRegionWithSuper(R, LCV->getRegion());<br> return RetrieveElement(LCV->getStore(), R);<br> }<br><br> // Other cases: give up.<br> return UnknownVal();<br> }<br>