3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-26 17:02:38 +00:00
z3/src
Nikolaj Bjorner 24f495f95c
fix #10220: clear stale nla lemmas in core::propagate() (#10224)
## Problem

egressions/smt2/10220.smt2 (datatype + nonlinear integer arithmetic over
`SBVRational`, expected `unsat`) crashes with an ACCESS_VIOLATION (issue
#10220). The crash only occurs with the default `theory_lra`
(`arith.solver=6`) and is independent of `arith.nl`.

## Root cause

Debug build gives a clean stack: a `SASSERT(n)` violation / null
dereference in `smt::relevancy_propagator_imp::is_relevant_core` reached
from `theory_lra::set_conflict_or_lemma ->
ctx().mark_as_relevant(literal)`. The literal's boolean variable has
`bool_var2expr(v) == nullptr`.

Tracing showed the same nla lemma core being processed twice — first at
scope 6, then, after a backtrack, again at scope 3 — where the bound
atoms internalized to build the lemma had their boolean variables
deleted by the pop:

\\\
SCOL scope=6 core=[32 27 35 30 6 14 ]
SCOL scope=3 core=[32*NULL* 27 35*NULL* 30 6 14 ]
\\\

Commit d60d6a066 (*add incremental propagate for nla to retain some
propagation lemmas*) removed the `clear()` call from `core::propagate()`
(the final-check path) while adding a symmetric
`incremental_propagate()` that keeps it. Consequently `m_lemmas`
generated at a deep scope survived a backtrack and were replayed at a
shallower scope, referencing deleted bool vars.

## Fix

Restore `clear()` at the start of `core::propagate()`. Both
`propagate()` and `incremental_propagate()` consume their lemmas
immediately via `add_lemmas()`, so lemmas never need to survive across
calls; starting each final-check propagation from a fresh lemma set
removes the stale replay.

## Validation

- `regressions/smt2/10220.smt2` -> `unsat` (was ACCESS_VIOLATION)
- `FStar.Math.Euclid-1` still `unsat`
- `FStar.Math.Euclid-2/-3` unchanged (already `unknown` on master,
verified against the pre-fix binary)

Fixes #10220.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 96a14756-2ffe-4cc3-87e7-49fda1b6113a
2026-07-24 20:01:38 -07:00
..
ackermannization block ackermann over nested selects 2026-06-19 10:41:56 -07:00
api Fix NameError: EXECUTABLE_FILE_FALLBACKS undefined on win32/darwin in setup.py (#10219) 2026-07-24 10:44:39 -07:00
ast Fix drain_backtrack to pop trail scopes and compile 2026-07-23 11:19:12 -07:00
cmd_context Use macros to disable semi-colon warnings for blocks of macros. (#10192) 2026-07-22 18:01:50 -07:00
math fix #10220: clear stale nla lemmas in core::propagate() (#10224) 2026-07-24 20:01:38 -07:00
model updates to tptp_frontend 2026-07-04 14:34:21 -07:00
muz Fix use-after-free in spacer hypothesis_reducer::reduce_core (#10123) 2026-07-14 15:18:02 -07:00
nlsat Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
opt opt: validate strict optimization optima faithfully with delta-rational bounds (#10059) 2026-07-09 10:39:23 -07:00
params nla: add LP-based nonlinear bound optimization for cross-nested confl… (#10180) 2026-07-23 09:00:46 -07:00
parsers Remove unnecessary semicolons (Attempt 2) (#10020) 2026-07-02 12:47:29 -07:00
qe qe2: eliminate fresh undeclared constant leak (#10172) 2026-07-23 11:19:13 -07:00
sat Fix unsound model from parallel QF_BV solving (#10133) (#10142) 2026-07-16 11:47:07 -07:00
shell Fixes necessary to compile z3 included in clang-tidy via FetchContents. (#9768) 2026-06-08 19:44:01 -07:00
smt Update theory_lra.cpp 2026-07-24 14:10:06 -07:00
solver fix: parallel mode exits unknown immediately for QF_BV due to reason-string mismatch (#10183) 2026-07-21 19:48:55 -07:00
tactic Use macros to disable semi-colon warnings for blocks of macros. (#10192) 2026-07-22 18:01:50 -07:00
test ci: add MinGW build/test job to Windows.yml (#10211) 2026-07-24 13:11:08 -07:00
util Fix MinGW linker errors: explicitly link dbghelp on Windows (#10203) 2026-07-23 10:25:58 -07:00
CMakeLists.txt git bindings v1.0 2026-02-18 21:02:25 -08:00