3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-11 13:40:52 +00:00

Fix division by zero handling inconsistency in arithmetic rewriter

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-06-20 21:46:57 +00:00
parent ed34556beb
commit b821aebbac

View file

@ -1140,7 +1140,10 @@ br_status arith_rewriter::mk_div_core(expr * arg1, expr * arg2, expr_ref & resul
if (m_util.is_numeral(arg2, v2, is_int)) {
SASSERT(!is_int);
if (v2.is_zero()) {
return BR_FAILED;
// For division by zero, create a consistent uninterpreted function
// This ensures that (div a 0) and (div (to_int a) 0) are handled consistently
result = m_util.mk_div0(arg1, arg2);
return BR_DONE;
}
else if (m_util.is_numeral(arg1, v1, is_int)) {
result = m_util.mk_numeral(v1/v2, false);