[all-commits] [llvm/llvm-project] f75bc5: [analyzer] Fix symbol simplification assertion fai...

Gabor Marton via All-commits all-commits at lists.llvm.org
Wed May 25 02:02:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f75bc5bfc8f898de10e14163998c63eeb2b9f705
      https://github.com/llvm/llvm-project/commit/f75bc5bfc8f898de10e14163998c63eeb2b9f705
  Author: Gabor Marton <gabor.marton at ericsson.com>
  Date:   2022-05-25 (Wed, 25 May 2022)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
    A clang/test/Analysis/symbol-simplification-assertion.c

  Log Message:
  -----------
  [analyzer] Fix symbol simplification assertion failure

Fixes https://github.com/llvm/llvm-project/issues/55546

The assertion mentioned in the issue is triggered because an
inconsistency is formed in the Sym->Class and Class->Sym relations. A
simpler but similar inconsistency is demonstrated here:
https://reviews.llvm.org/D114887 .

Previously in `removeMember`, we didn't remove the old symbol's
Sym->Class relation. Back then, we explained it with the following two
bullet points:
> 1) This way constraints for the old symbol can still be found via it's
> equivalence class that it used to be the member of.
> 2) Performance and resource reasons. We can spare one removal and thus one
> additional tree in the forest of `ClassMap`.

This patch do remove the old symbol's Sym->Class relation in order to
keep the Sym->Class relation consistent with the Class->Sym relations.
Point 2) above has negligible performance impact, empirical measurements
do not show any noticeable difference in the run-time. Point 1) above
seems to be a not well justified statement. This is because we cannot
create a new symbol that would be equal to the old symbol after the
simplification had happened. The reason for this is that the SValBuilder
uses the available constant constraints for each sub-symbol.

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




More information about the All-commits mailing list