From fb3060dc3dc314c5181c69adb30992aea6397a65 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 10 Sep 2020 13:47:36 +0200 Subject: [PATCH] Java: Minor fixup for SSA AdjacentUsesImpl::varBlockReaches This should not change anything in regards to correctness overall -- what we really care about is `varBlockStep`, and that checks `varOccursInBlock(v, b2)`. However, the comment is a bit easier to read together with the code now (and probably also gives slightly smaller predicate result size). --- java/ql/src/semmle/code/java/dataflow/SSA.qll | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/ql/src/semmle/code/java/dataflow/SSA.qll b/java/ql/src/semmle/code/java/dataflow/SSA.qll index e6d92bb4d60..84d6f179efb 100644 --- a/java/ql/src/semmle/code/java/dataflow/SSA.qll +++ b/java/ql/src/semmle/code/java/dataflow/SSA.qll @@ -779,7 +779,9 @@ private module SsaImpl { * between `b1` and `b2`. */ private predicate varBlockReaches(TrackedVar v, BasicBlock b1, BasicBlock b2) { - varOccursInBlock(v, b1) and b2 = b1.getABBSuccessor() + varOccursInBlock(v, b1) and + b2 = b1.getABBSuccessor() and + blockPrecedesVar(v, b2) or exists(BasicBlock mid | varBlockReaches(v, b1, mid) and