Merge pull request #5859 from MathiasVP/fix-fp-in-comparison-with-wider-type

C++: Fix false positive in `cpp/comparison-with-wider-type`
This commit is contained in:
Mathias Vorreiter Pedersen
2021-05-10 17:58:31 +02:00
committed by GitHub
3 changed files with 12 additions and 1 deletions

View File

@@ -49,7 +49,9 @@ where
small = rel.getLesserOperand() and
large = rel.getGreaterOperand() and
rel = l.getCondition().getAChild*() and
upperBound(large).log2() > getComparisonSize(small) * 8 and
forall(Expr conv | conv = large.getConversion*() |
upperBound(conv).log2() > getComparisonSize(small) * 8
) and
// Ignore cases where the smaller type is int or larger
// These are still bugs, but you should need a very large string or array to
// trigger them. We will want to disable this for some applications, but it's