Skip to content

Commit 2c4f77b

Browse files
committed
fix: disable stringop-overread for gcc11
This workaround let enable -Werror -Wall on our CI, otherwise compilation of uint256.h fails with this error: In member function ‘constexpr int base_blob<BITS>::Compare(const base_blob<BITS>&) const [with unsigned int BITS = 256]’, inlined from ‘constexpr bool operator!=(const base_blob<256>&, const base_blob<256>&)’ at ./uint256.h:58:96, inlined from ‘bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock&, gsl::not_null<const CBlockIndex*>, BlockValidationState&, const CCoinsViewCache&, CDeterministicMNList&, llmq::CQuorumSnapshotManager&, bool)’ at evo/deterministicmns.cpp:818:119: ./uint256.h:55:77: error: ‘int __builtin_memcmp_eq(const void*, const void*, long unsigned int)’ specified bound 32 exceeds source size 0 [-Werror=stringop-overread] 55 | constexpr int Compare(const base_blob& other) const { return std::memcmp(m_data.data(), other.m_data.data(), WIDTH); } | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors
1 parent 8af10d7 commit 2c4f77b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,15 @@ if test "x$enable_werror" = "xyes"; then
457457
AX_CHECK_COMPILE_FLAG([-Werror=return-type], [], [ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wno-error=return-type"], [$CXXFLAG_WERROR],
458458
[AC_LANG_SOURCE([[#include <cassert>
459459
int f(){ assert(false); }]])])
460+
dnl -Wstringop-overread is broken in GCC 11.
461+
AC_COMPILE_IFELSE(
462+
[AC_LANG_PROGRAM([[]],
463+
[[#if __GNUC__ == 11
464+
#error -Wstringop-overread is broken in GCC 11
465+
#endif
466+
]])],
467+
[],
468+
[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wno-stringop-overread"])
460469
fi
461470

462471
if test "x$CXXFLAGS_overridden" = "xno"; then

0 commit comments

Comments
 (0)