[PATCH] D81254: [analyzer] Produce symbolic values for C-array elements

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 07:34:50 PDT 2020


NoQ added a comment.

Here are some examples:

  void test1(int *a, int index1, int index2) {
    int x = a[index1];
    a[index2] = 0;
    int y = a[index1];
  
    // In reality we don't know but after your patch
    // we're confident that this is "TRUE".
    clang_analyzer_eval(x == y);
  }
  
  void foo(int *a); // Potentially modifies elements of 'a'.
  
  void test2(int *a, int index) {
    int x = a[index];
    foo(a);
    int y = a[index];
  
    // In reality we don't know but after your patch
    // we're confident that this is "TRUE".
    clang_analyzer_eval(x == y);
  }


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

https://reviews.llvm.org/D81254





More information about the cfe-commits mailing list