Skip to content

Commit bef19c7

Browse files
committed
C#: Do not use the SSA definition expression for sign of increment and decrement (only use the specialized code, which is already present).
1 parent dda27b4 commit bef19c7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ private module Impl {
125125
SsaExplicitWrite getExplicitSsaAssignment(SsaExplicitWrite v) { result = v }
126126

127127
/** Returns the assignment of the variable update `def`. */
128-
ExprNode getExprFromSsaAssignment(SsaExplicitWrite def) { result.getExpr() = def.getValue() }
128+
ExprNode getExprFromSsaAssignment(SsaExplicitWrite def) {
129+
result.getExpr() = def.getValue() and not def.getDefiningExpr() instanceof MutatorOperation
130+
}
129131

130132
/** Holds if `def` can have any sign. */
131133
predicate explicitSsaDefWithAnySign(SsaExplicitWrite def) {

0 commit comments

Comments
 (0)