Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49fbc41

Browse files
authored
Merge pull request #414 from aschackmull/java/unreachable-ssa
Java: Don't construct nonsense SSA for unreachable code.
2 parents fc5b195 + fa3fa33 commit 49fbc41

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

java/ql/src/semmle/code/java/dataflow/SSA.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ private module SsaImpl {
225225
cached
226226
predicate certainVariableUpdate(TrackedVar v, ControlFlowNode n, BasicBlock b, int i) {
227227
exists(VariableUpdate a | a = n | getDestVar(a) = v) and
228-
b.getNode(i) = n
228+
b.getNode(i) = n and
229+
hasDominanceInformation(b)
229230
or
230231
certainVariableUpdate(v.getQualifier(), n, b, i)
231232
}
@@ -559,7 +560,8 @@ private module SsaImpl {
559560
cached
560561
predicate uncertainVariableUpdate(TrackedVar v, ControlFlowNode n, BasicBlock b, int i) {
561562
exists(Call c | c = n | updatesNamedField(c, v, _)) and
562-
b.getNode(i) = n
563+
b.getNode(i) = n and
564+
hasDominanceInformation(b)
563565
or
564566
uncertainVariableUpdate(v.getQualifier(), n, b, i)
565567
}

java/ql/src/semmle/code/java/dataflow/internal/BaseSSA.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ private module SsaImpl {
7272
cached
7373
predicate variableUpdate(BaseSsaSourceVariable v, ControlFlowNode n, BasicBlock b, int i) {
7474
exists(VariableUpdate a | a = n | getDestVar(a) = v) and
75-
b.getNode(i) = n
75+
b.getNode(i) = n and
76+
hasDominanceInformation(b)
7677
}
7778

7879
/** Gets the definition point of a nested class in the parent scope. */

0 commit comments

Comments
 (0)