This issue was copied from checkedc/checkedc-clang#1031
Intersecting the set of in-scope variables across the predecessors of a basic block excludes most variables that are not in-scope for the basic block. However, an exception is when a variable goes out of scope within the basic block. When this happens, the bug in #1017 manifests.
Fix:
Enabling the AddLifetime flag during CFG construction produces the CFGLifetimeEnds CFGElement for every variable that goes out of scope. When we encounter this CFGElement, we remove the variable that goes out of scope from the ObservedBounds map if it is a checked pointer, and also delete all available expressions that use this out-of-scope variable.
This issue was copied from checkedc/checkedc-clang#1031
Intersecting the set of in-scope variables across the predecessors of a basic block excludes most variables that are not in-scope for the basic block. However, an exception is when a variable goes out of scope within the basic block. When this happens, the bug in #1017 manifests.
Fix:
Enabling the
AddLifetimeflag during CFG construction produces theCFGLifetimeEndsCFGElementfor every variable that goes out of scope. When we encounter thisCFGElement, we remove the variable that goes out of scope from theObservedBoundsmap if it is a checked pointer, and also delete all available expressions that use this out-of-scope variable.