Skip to content

Commit 98ab2b2

Browse files
committed
C#: Fix bad join-order in guardImpliesNotEqual()
1 parent 5ecf680 commit 98ab2b2

File tree

1 file changed

+5
-4
lines changed
  • csharp/ql/src/semmle/code/csharp/controlflow

1 file changed

+5
-4
lines changed

csharp/ql/src/semmle/code/csharp/controlflow/Guards.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,8 +1058,10 @@ module Internal {
10581058
conditionalAssign(guard, vGuard, def, vDef.getAnExpr())
10591059
}
10601060

1061-
private predicate relevantEq(PreSsa::Definition def, AbstractValue v) {
1062-
conditionalAssignVal(_, _, def, v)
1061+
pragma[noinline]
1062+
private predicate relevantEq(PreSsa::Definition def, AbstractValue v, AssignableRead ar) {
1063+
conditionalAssignVal(_, _, def, v) and
1064+
ar = def.getARead()
10631065
}
10641066

10651067
/**
@@ -1156,8 +1158,7 @@ module Internal {
11561158
private predicate guardImpliesNotEqual(
11571159
Expr guard, AbstractValue vGuard, PreSsa::Definition def, AbstractValue vDef
11581160
) {
1159-
relevantEq(def, vDef) and
1160-
exists(AssignableRead ar | ar = def.getARead() |
1161+
exists(AssignableRead ar | relevantEq(def, vDef, ar) |
11611162
// For example:
11621163
// if (de == null); vGuard = TBooleanValue(false); vDef = TNullValue(true)
11631164
// but not

0 commit comments

Comments
 (0)