[PATCH] D106136: [Analyzer][solver] Fix equivalence class invariant violation in removeDeadBindings

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 16 02:44:50 PDT 2021


martong created this revision.
martong added reviewers: vsavchenko, NoQ, steakhal.
Herald added subscribers: manas, ASDenysPetrov, gamesh411, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity.
Herald added a reviewer: Szelethus.
martong requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There is an invariant in the range based solver for equivalence classes.
We don't store class->member associations for trivial classes in the
state (`ClassMembers`). This means any SymbolSet stored in ClassMembers
must have at least two members. This invariant is violated in
removeDeadBindings, because we remove a class from `ClassMembers` only
once it became empty.

Fixing this invariant violation implies that we must prepare for element
removals from an equivalence class. An element removal might result in
downgrading a non-trivial class to trivial, also the representative
symbol might be changed. If the representative symbol has changed then
we have to re-key constraints and the disequality info.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106136

Files:
  clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
  clang/test/Analysis/equivalence-classes-and-remove-dead.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106136.359265.patch
Type: text/x-patch
Size: 16310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210716/d520ccd8/attachment-0001.bin>


More information about the cfe-commits mailing list