3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-01-27 20:38:42 +00:00
z3/src/opt
Lev Nachmanson c0583b828d
preserve the initial state of the solver with push/pop for multiple objectives (#8264)
* preserve the initial state of the solver with push/pop for multiple objectives

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>

* Fix memory corruption in Z3_polynomial_subresultants

The API function had a memory corruption bug where allocating the result
vector while the default_expr2polynomial converter was still in scope
could corrupt the converter's internal expr2var mapping.

Fixed by restructuring the code to:
1. Complete all polynomial computation in a scoped block
2. Store results in a temporary expr_ref_vector
3. Let the converter go out of scope
4. Then allocate and populate the result vector

Also improved the test to:
- Use randomized testing with 20 iterations
- Test both cases: variable in polynomials and variable not in polynomials
- Use proper reference counting (inc_ref before dec_ref)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:41:03 -08:00
..
CMakeLists.txt adding totalizer 2022-06-29 08:20:01 -07:00
maxcore.cpp Refactor mk_and/mk_or call sites to use vector overloads (#8286) 2026-01-22 13:21:22 -08:00
maxcore.h update wcnf front-end and add new wcnf strategy 2026-01-01 17:50:42 -08:00
maxlex.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
maxlex.h separate pre-processing, add callback parameter to push/pop in python API 2022-04-11 17:05:59 +02:00
maxsmt.cpp update wcnf front-end and add new wcnf strategy 2026-01-01 17:50:42 -08:00
maxsmt.h Fix unused parameter warnings in empty override functions by omitting parameter names (#8174) 2026-01-12 21:27:33 -08:00
opt_cmds.cpp Fix unused parameter warnings in empty override functions by omitting parameter names (#8174) 2026-01-12 21:27:33 -08:00
opt_cmds.h booyah 2020-07-04 15:56:30 -07:00
opt_context.cpp Refactor mk_and/mk_or call sites to use vector overloads (#8286) 2026-01-22 13:21:22 -08:00
opt_context.h fix #8102 2025-12-23 09:44:22 -08:00
opt_cores.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
opt_cores.h add option to "rotate" cores during core finding 2022-05-01 15:26:56 -07:00
opt_lns.cpp refine maxresw option 2026-01-02 16:23:51 -08:00
opt_lns.h Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
opt_mux.h separate pre-processing, add callback parameter to push/pop in python API 2022-04-11 17:05:59 +02:00
opt_params.pyg update wcnf front-end and add new wcnf strategy 2026-01-01 17:50:42 -08:00
opt_pareto.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
opt_pareto.h Use = default for virtual constructors. 2022-08-05 18:11:46 +03:00
opt_parse.cpp Refactor mk_and/mk_or call sites to use vector overloads (#8286) 2026-01-22 13:21:22 -08:00
opt_parse.h booyah 2020-07-04 15:56:30 -07:00
opt_preprocess.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
opt_preprocess.h core opt 2022-05-21 10:27:37 -04:00
opt_sls_solver.h Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
opt_solver.cpp preserve the initial state of the solver with push/pop for multiple objectives (#8264) 2026-01-23 10:41:03 -08:00
opt_solver.h add user propagators to opt_solver 2025-10-02 19:44:22 -07:00
optsmt.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
optsmt.h fix #5254 2021-05-17 15:42:01 -07:00
pb_sls.cpp Centralize and document TRACE tags using X-macros (#7657) 2025-05-28 14:31:25 +01:00
pb_sls.h booyah 2020-07-04 15:56:30 -07:00
sortmax.cpp Refactor mk_and and mk_app to use std::span API (#8285) 2026-01-22 16:58:38 -08:00
totalizer.cpp totalizer 2022-06-30 19:49:19 -07:00
totalizer.h totalizer 2022-06-30 19:49:19 -07:00
wmax.cpp Add [[nodiscard]] to AST factory functions and modernize iterator loops (#8143) 2026-01-11 09:58:25 -08:00
wmax.h re-enable pre-process 2022-04-13 11:24:24 +02:00