From e99a6fc1d86b30ebccc73f7e83f0a220123f2027 Mon Sep 17 00:00:00 2001 From: dr7ana Date: Tue, 4 Jun 2024 07:27:34 -0700 Subject: [PATCH] GCC stringop bug - FMT will trigger a gcc bug on stringop-overflow with gcc versions 11 and earlier - FMT issue https://github.com/fmtlib/fmt/pull/2442 - FMT issue https://github.com/fmtlib/fmt/issues/2708 - GCC bug tracker https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101854 - Confirming it still appears on gcc-11 https://godbolt.org/z/d15q4Exvz --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f574dde5..b441d200 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,8 +112,13 @@ if (WARNINGS_AS_ERRORS) endif() add_library(libquic_internal-warnings INTERFACE) -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0) - target_compile_options(libquic_internal-warnings INTERFACE -fconcepts) +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0) + target_compile_options(libquic_internal-warnings INTERFACE -fconcepts) + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0.0) + list(APPEND warning_flags -Wno-error=stringop-overflow) # gcc 11 and earlier bug + endif() endif() target_compile_options(libquic_internal-warnings INTERFACE "$<$,$>:${warning_flags}>")