Skip to content

Commit 9b7f986

Browse files
committed
Fixed FP issue with ignorable constants, now no longer relying on the constant being a literal, but a known value variable or literal.
1 parent ec3b350 commit 9b7f986

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

cpp/ql/src/Likely Bugs/Leap Year/UncheckedLeapYearAfterYearModificationPrecise.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class IgnorableExprRem extends IgnorableOperation instanceof RemExpr { }
2525
*/
2626
class IgnorableExpr10MulipleComponent extends IgnorableOperation {
2727
IgnorableExpr10MulipleComponent() {
28-
this.(MulExpr).getAnOperand().(Literal).getValue().toInt() in [10, 100, 100]
28+
this.(MulExpr).getAnOperand().getValue().toInt() in [10, 100, 100]
2929
or
3030
exists(AssignMulExpr a | a.getRValue() = this |
31-
a.getRValue().(Literal).getValue().toInt() in [10, 100, 100]
31+
a.getRValue().getValue().toInt() in [10, 100, 100]
3232
)
3333
}
3434
}
@@ -39,9 +39,9 @@ class IgnorableExpr10MulipleComponent extends IgnorableOperation {
3939
*/
4040
class IgnorableExpr48Mapping extends IgnorableOperation {
4141
IgnorableExpr48Mapping() {
42-
this.(SubExpr).getRightOperand().(Literal).getValue().toInt() = 48
42+
this.(SubExpr).getRightOperand().getValue().toInt() = 48
4343
or
44-
exists(AssignSubExpr e | e.getRValue() = this | e.getRValue().(Literal).getValue().toInt() = 48)
44+
exists(AssignSubExpr e | e.getRValue() = this | e.getRValue().getValue().toInt() = 48)
4545
}
4646
}
4747

@@ -87,10 +87,10 @@ predicate isLikelyConversionConstant(int c) {
8787
class IgnorableConstantArithmetic extends IgnorableOperation {
8888
IgnorableConstantArithmetic() {
8989
exists(int i | isLikelyConversionConstant(i) |
90-
this.(Operation).getAnOperand().(Literal).getValue().toInt() = i
90+
this.(Operation).getAnOperand().getValue().toInt() = i
9191
or
9292
exists(AssignArithmeticOperation a | this = a.getRValue() |
93-
a.getRValue().(Literal).getValue().toInt() = i
93+
a.getRValue().getValue().toInt() = i
9494
)
9595
)
9696
}

0 commit comments

Comments
 (0)