Skip to content

Commit f91bd91

Browse files
committed
C++: Apply suggested change from code review
1 parent e93dc0b commit f91bd91

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,8 +1546,13 @@ private float getGuardedUpperBound(VariableAccess guardedAccess) {
15461546
// node is attached to the block at the end of the edge and not on
15471547
// the actual edge. It is therefore not possible to determine which
15481548
// edge the guard phi node belongs to. The predicate below ensures
1549-
// that there is one predecessor, albeit somewhat conservative.
1550-
exists(unique(BasicBlock b | b = def.(BasicBlock).getAPredecessor())) and
1549+
// that any predecessor other than the guard block is dominated by the
1550+
// guard phi node.
1551+
forall(BasicBlock pred |
1552+
pred = def.(BasicBlock).getAPredecessor() and pred != guard.getBasicBlock()
1553+
|
1554+
bbDominates(def, pred)
1555+
) and
15511556
guardedAccess = def.getAUse(v) and
15521557
result = max(float ub | upperBoundFromGuard(guard, guardVa, ub, branch))
15531558
)

0 commit comments

Comments
 (0)