3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

pass algebraic manager to arith-plugin mk-numeral because rational check may overwrite the argument using the current manager deals with crash as part of #4532

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-07-26 17:52:28 -07:00
parent ac39ddb43f
commit c7704ef9af
11 changed files with 43 additions and 45 deletions

View file

@ -31,6 +31,7 @@ public:
mpq():m_den(1) {}
mpq(mpq &&) noexcept = default;
mpq & operator=(mpq&&) = default;
mpq & operator=(mpq const&) = delete;
void swap(mpq & other) { m_num.swap(other.m_num); m_den.swap(other.m_den); }
mpz const & numerator() const { return m_num; }
mpz const & denominator() const { return m_den; }

View file

@ -202,12 +202,14 @@ mpz_cell * mpz_manager<SYNCH>::allocate(unsigned capacity) {
}
#endif
cell->m_capacity = capacity;
return cell;
}
template<bool SYNCH>
void mpz_manager<SYNCH>::deallocate(bool is_heap, mpz_cell * ptr) {
if (is_heap) {
#ifdef SINGLE_THREAD
m_allocator.deallocate(cell_size(ptr->m_capacity), ptr);
#else

View file

@ -106,6 +106,7 @@ public:
std::swap(m_ptr, other.m_ptr);
}
mpz& operator=(mpz const& other) = delete;
mpz& operator=(mpz &&other) {
swap(other);
return *this;
@ -535,13 +536,6 @@ public:
}
}
void set(mpz & target, mpz && source) {
target.m_val = source.m_val;
std::swap(target.m_ptr, source.m_ptr);
auto o = target.m_owner; target.m_owner = source.m_owner; source.m_owner = o;
auto k = target.m_kind; target.m_kind = source.m_kind; source.m_kind = k;
}
void set(mpz & a, int val) {
a.m_val = val;
a.m_kind = mpz_small;
@ -724,6 +718,7 @@ public:
// Store the digits of n into digits, and return the sign.
bool decompose(mpz const & n, svector<digit_t> & digits);
};
#ifndef SINGLE_THREAD