diff --git a/stage0/src/runtime/compact.cpp b/stage0/src/runtime/compact.cpp index fe4e8be044..1d899fd155 100644 --- a/stage0/src/runtime/compact.cpp +++ b/stage0/src/runtime/compact.cpp @@ -274,11 +274,11 @@ void object_compactor::insert_mpz(object * o) { size_t data_sz = sizeof(mpn_digit) * to_mpz(o)->m_value.m_size; size_t sz = sizeof(mpz_object) + data_sz; mpz_object * new_o = (mpz_object *)alloc(sz); + memcpy(new_o, to_mpz(o), sizeof(mpz_object)); lean_set_non_heap_header((lean_object*)new_o, sz, LeanMPZ, 0); - new_o->m_value.m_size = to_mpz(o)->m_value.m_size; - new_o->m_value.m_sign = to_mpz(o)->m_value.m_sign; - new_o->m_value.m_digits = reinterpret_cast(reinterpret_cast(new_o) + sizeof(mpz_object)); - memcpy(new_o->m_value.m_digits, to_mpz(o)->m_value.m_digits, data_sz); + void * data = reinterpret_cast(new_o) + sizeof(mpz_object); + memcpy(data, to_mpz(o)->m_value.m_digits, data_sz); + new_o->m_value.m_digits = reinterpret_cast(reinterpret_cast(data) - reinterpret_cast(m_begin) + reinterpret_cast(m_base_addr)); save(o, (lean_object*)new_o); #endif } diff --git a/stage0/src/util/shell.cpp b/stage0/src/util/shell.cpp index 6709d9f21d..0a9a987128 100644 --- a/stage0/src/util/shell.cpp +++ b/stage0/src/util/shell.cpp @@ -64,7 +64,7 @@ Author: Leonardo de Moura enum arg_opt { no_argument, required_argument, optional_argument }; struct option { - const char name[12]; + const char name[20]; arg_opt has_arg; int *flag; char val;