From 15ed0f6a845500c6dba0b3d827d341d8de0d15c6 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 6 Jul 2021 13:13:30 +0300 Subject: [PATCH] mdbx++: workaround for compile-time 'uninitialized' warning (i.e. a GCC's bug) from GCC 10.x with enabled UB-sanitizer. --- mdbx.h++ | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mdbx.h++ b/mdbx.h++ index 3bd7c61f..fae4c441 100644 --- a/mdbx.h++ +++ b/mdbx.h++ @@ -1172,6 +1172,9 @@ private: /* properly destroy allocator::pointer */ allocated_.~allocated(); } + if (::std::is_trivial::value) + /* workaround for "uninitialized" warning from some compilers */ + ::std::memset(&allocated_.ptr_, 0, sizeof(allocated_.ptr_)); lastbyte() = inplace_lastbyte_mask(); MDBX_CONSTEXPR_ASSERT(is_inplace() && address() == inplace_ && is_suitable_for_inplace(capacity()));