3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-13 04:13:01 +00:00

Fix implicit conversion warnings: use UINT_MAX instead of -1 for unsi… (#8342)

* Fix implicit conversion warnings: use UINT_MAX instead of -1 for unsigned variables

Replace implicit conversion from negative literal to unsigned type
with explicit UINT_MAX constant to eliminate compiler warnings.

Fixed 10 instances across 6 files:
- src/ast/rewriter/bv_rewriter.cpp: 1 instance
- src/ast/sls/sls_bv_tracker.h: 2 instances
- src/math/lp/dioph_eq.cpp: 3 instances
- src/math/lp/lp_primal_core_solver.h: 2 instances
- src/muz/transforms/dl_mk_array_instantiation.cpp: 1 instance
- src/muz/transforms/dl_mk_synchronize.cpp: 1 instance

These changes preserve the exact same runtime behavior (UINT_MAX
equals the wrapped value of -1 for unsigned types) while making
the code more explicit and warning-free.

* Update bv_rewriter.cpp

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Nikolaj Bjorner 2026-01-25 22:35:43 -08:00 committed by GitHub
parent 023377f3c8
commit 8a0207700c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 11 deletions

View file

@ -24,7 +24,6 @@ Notes:
#include "ast/ast_pp.h"
void bv_rewriter::updt_local_params(params_ref const & _p) {
bv_rewriter_params p(_p);
m_hi_div0 = p.hi_div0();
@ -683,7 +682,7 @@ unsigned bv_rewriter::propagate_extract(unsigned high, expr * arg, expr_ref & re
bool all_numerals = true;
unsigned removable = to_remove;
numeral val;
unsigned curr_first_sz = -1;
unsigned curr_first_sz = UINT_MAX;
// calculate how much can be removed
for (unsigned i = 0; i < num; ++i) {
expr * const curr = a->get_arg(i);