[all-commits] [llvm/llvm-project] f0bc7d: [analyzer] Fix region cast between the same types ...

Denys Petrov via All-commits all-commits at lists.llvm.org
Mon Nov 15 09:23:17 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f0bc7d24882ab84f6398a1ea614dd0bf6e2a1085
      https://github.com/llvm/llvm-project/commit/f0bc7d24882ab84f6398a1ea614dd0bf6e2a1085
  Author: Denys Petrov <dpetrov at accesssoftek.com>
  Date:   2021-11-15 (Mon, 15 Nov 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/Store.cpp
    M clang/test/Analysis/initialization.cpp

  Log Message:
  -----------
  [analyzer] Fix region cast between the same types with different qualifiers.

Summary: Specifically, this fixes the case when we get an access to array element through the pointer to element. This covers several FIXME's. in https://reviews.llvm.org/D111654.
Example:
  const int arr[4][2];
  const int *ptr = arr[1]; // Fixes this.
The issue is that `arr[1]` is `int*` (&Element{Element{glob_arr5,1 S64b,int[2]},0 S64b,int}), and `ptr` is `const int*`. We don't take qualifiers into account. Consequently, we doesn't match the types as the same ones.

Differential Revision: https://reviews.llvm.org/D113480




More information about the All-commits mailing list