Skip to content

Commit 17737cd

Browse files
committed
C++: Account for unreachable blocks in guards
This restores the code I removed in 4642037.
1 parent ad401e9 commit 17737cd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ class IRGuardCondition extends Instruction {
466466
branchBlock.getASuccessor() = succ and
467467
forall(IRBlock pred | pred = succ.getAPredecessor() and pred != branchBlock |
468468
succ.dominates(pred)
469+
or
470+
// An unreachable `pred` is vacuously dominated by `succ` since all
471+
// paths from the entry to `pred` go through `succ`. Such vacuous
472+
// dominance is not included in the `dominates` predicate since that
473+
// could cause quadratic blow-up.
474+
not pred.isReachableFromFunctionEntry()
469475
)
470476
)
471477
}

0 commit comments

Comments
 (0)