From fad402d037d8d16aef57a9757355c8e7f9ebb0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 23 Dec 2024 19:35:53 +0100 Subject: [PATCH] Fixes #234 ("dlmalloc_ext_2_8_6.c:warning: iteration 2305843009213693951 invokes undefined behavior") --- doc/container.qbk | 1 + src/dlmalloc_ext_2_8_6.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/doc/container.qbk b/doc/container.qbk index 4c62c326..f0ada5a5 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1425,6 +1425,7 @@ use [*Boost.Container]? There are several reasons for that: * Fixed bugs/issues: * [@https://github.com/boostorg/container/issues/297 GitHub #297: ['"flat_map::try_emplace does not compile if allocator has construct"]]. + * [@https://github.com/boostorg/container/issues/234 GitHub #234: ['"dlmalloc_ext_2_8_6.c:warning: iteration 2305843009213693951 invokes undefined behavior"]]. [endsect] diff --git a/src/dlmalloc_ext_2_8_6.c b/src/dlmalloc_ext_2_8_6.c index 778dd882..ea4b9941 100644 --- a/src/dlmalloc_ext_2_8_6.c +++ b/src/dlmalloc_ext_2_8_6.c @@ -36,6 +36,8 @@ #define FORCEINLINE inline #endif +#define DLMALLOC_EXT_GCC_VERSION + #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4127) @@ -47,6 +49,18 @@ #pragma warning (disable : 4057) /*differs in indirection to slightly different base types from*/ #pragma warning (disable : 4702) /*unreachable code*/ #pragma warning (disable : 4127) /*conditional expression is constant*/ +#elif defined(__GNUC__) + +# if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 48000) + //Disable false positives triggered by -Waggressive-loop-optimizations +# pragma GCC diagnostic ignored "-Waggressive-loop-optimizations" +# endif + +# if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 46000) + //Disable false positives triggered by -Warray-bounds +# pragma GCC diagnostic ignored "-Warray-bounds" +# endif + #endif #include "dlmalloc_2_8_6.c"