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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 05:08:26 PDT 2020


martong added a comment.

About the whole raw offset and the related warning. There is a fundamental question: Should we warn at `&a[0][10]` ?

  void foo() {
    int a[10][10];
    int *p0 = &a[9][9];   // OK
    int *p1 = &a[10][10]; // Out-of-bounds
    static_assert(&a[0][10] == &a[1][0]);
    int *p2 = &a[0][10];  // Syntactically (or technically) out-of-bounds, We should warn here !(?)
    int *p3 = &a[1][0];   // Neither syntactically nor semantically out-of-bounds, but it aliases with p2 and p2 is flawed
  }


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