[PATCH] D86874: [analyzer] Fix ArrayBoundCheckerV2 false positive regarding size_t indexer

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 3 00:09:39 PDT 2020


NoQ added a comment.

> `len + 1 < 0`

What are types of each term in this expression?

Like, if everything here was promoted to `size_t`, as it should be according to the language rules, then this comparison is trivially false and our constraint manager is definitely smart enough to figure this out.

> into `len < -1`

And this is an incorrect transformation assuming everything is of type `size_t`. The original statement was trivially false whereas this statement is true for almost every value - except, well, `SIZE_MAX`. If it's the checker doing this, it's doing something wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86874



More information about the cfe-commits mailing list