[PATCH] D124658: [analyzer] Canonicalize SymIntExpr so the RHS is positive when possible

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 05:33:31 PDT 2022


martong added a comment.

> This avoid producing very large RHS in case when the symbol is cased to unsigned number, and as consequence makes the value more robust in presence of cast.

Could you please elaborate on this? I understand that you'd like to simplify certain binary operations by merging the RHS and the operand, however, I don't see what are the empirical problems that this patch supposed to fix. E.g. did you encounter a crash without the fix, or was it the mentioned infeasible state (`(l - 1000) > 0`) that caused a false positive? If that is the case, I believe the huge cast patch <https://reviews.llvm.org/D103096> is going to solve it. Could you please check if those infeasible cases are solved by the mentioned D103096 <https://reviews.llvm.org/D103096> (you have to set `support-symbolic-integer-casts=true`) ?



================
Comment at: clang/test/Analysis/additive-op-on-sym-int-expr.c:18
+  if ((l - 1000) > 0) {
+    clang_analyzer_warnIfReached();
+  }
----------------
And same below for the other infeasible cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124658/new/

https://reviews.llvm.org/D124658



More information about the cfe-commits mailing list