[all-commits] [llvm/llvm-project] deed19: [analyzer] Prune infeasible states related to conc...

Arseniy Zaostrovnykh via All-commits all-commits at lists.llvm.org
Wed Jul 29 05:27:34 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: deed195c31f0ece487aa5ef79c90633860f10b93
      https://github.com/llvm/llvm-project/commit/deed195c31f0ece487aa5ef79c90633860f10b93
  Author: Arseniy Zaostrovnykh <necto.ne at gmail.com>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
    M clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
    M clang/test/Analysis/pthreadlock.c
    A clang/test/Analysis/simplify-drops-concrete.c
    M clang/test/Analysis/z3/z3-crosscheck.c

  Log Message:
  -----------
  [analyzer] Prune infeasible states related to concrete ints early to fix a crash (#210912)

RangedConstraintManager discards a simplified symbol if it reduces to a
concrete integer. This leads to delayed realization that some state
might be infeasible (because the concrete integer does not fit in the
assumed range), which might produce unexpected null pointers on the
following state splits.

PthreadLockChecker has fallen just into this trap. It assumes
`pthread_mutex_lock` is always called in a feasible state, which is was
not true.
In particular, in ZFS the analyzer crashes when runs in CTU mode because
it reaches `pthread_mutex_lock()` in over-constraint state (see the
reduced example in the first commit).

Checkers rely on the invariant that a state split can never result in
both `StateRef`s being null. To fix this violation of the invariant,
this patch helps RangedConstraintManager to realize a state is
infeasible and abort its exploration early so no follow-up state split
produce unexpected null-null pair.

Assisted by Claude Opus 4.8

--
CPP-8665



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list