mdbx++: workaround for compile-time 'uninitialized' warning (i.e. a GCC's bug) from GCC 10.x with enabled UB-sanitizer.

This commit is contained in:
Leonid Yuriev 2021-07-06 13:13:30 +03:00
parent ffb8d23632
commit 15ed0f6a84

View File

@ -1172,6 +1172,9 @@ private:
/* properly destroy allocator::pointer */ /* properly destroy allocator::pointer */
allocated_.~allocated(); allocated_.~allocated();
} }
if (::std::is_trivial<allocator_pointer>::value)
/* workaround for "uninitialized" warning from some compilers */
::std::memset(&allocated_.ptr_, 0, sizeof(allocated_.ptr_));
lastbyte() = inplace_lastbyte_mask(); lastbyte() = inplace_lastbyte_mask();
MDBX_CONSTEXPR_ASSERT(is_inplace() && address() == inplace_ && MDBX_CONSTEXPR_ASSERT(is_inplace() && address() == inplace_ &&
is_suitable_for_inplace(capacity())); is_suitable_for_inplace(capacity()));