[PATCH] D13126: New static analyzer checker for loss of sign/precision

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 06:48:31 PST 2015


danielmarjamaki added a comment.

Thanks a lot for those comments. I'll try your suggestions. I will try to upload some samples where I think the ProgramState is wrong.


================
Comment at: lib/StaticAnalyzer/Checkers/ConversionChecker.cpp:78
@@ +77,3 @@
+
+// Can E value be greater or equal than Val?
+static bool canBeGreaterEqual(CheckerContext &C, const Expr *E,
----------------
NoQ wrote:
> It's not quite "the value can be greater or equal", but in fact rather "the value is certainly greater or equal".
> Same applies to `canBeNegative()`.
I disagree.

    int A = 0;
    if (X) {
         A = 1000;
    }
    U8 = A;  // <- Imho; A _can_ be 1000

Imho it's better to say that A _can_ be 1000 unless A is 1000 for all possible execution paths through the code.



http://reviews.llvm.org/D13126





More information about the cfe-commits mailing list