[PATCH] D35109: [Analyzer] SValBuilder Comparison Rearrangement

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 07:07:32 PDT 2017


baloghadamsoftware added a comment.

I think we should exclude unsigned types completely. `A >= B` is converted to `A - B >= 0`, thus the range of `A - B` is `[0 .. INT_MAX]` which is the full range for the unsigned type. This implies that upon any conditional statement `if (A >= B) ...` the range for the `false` is an empty range so the `else` branch is never executed. The following test fails:

`void wrong(int m, int n) {

  if (m >= n)
    return;
  clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}

}`


https://reviews.llvm.org/D35109





More information about the cfe-commits mailing list