From 6870e4b06bbf0a0ddd98534a393a561261b3153c Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Thu, 5 Sep 2024 15:23:12 +0500 Subject: [PATCH] Workaround for GCC regression: false positive null-dereference in vector.resize Signed-off-by: Vladislav Shchapov --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adf1262e..1ca64fff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,7 +240,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif () if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wshift-overflow=2 - -Wnull-dereference -Wduplicated-cond) + -Wduplicated-cond) + # Workaround for GCC regression + # [12/13/14/15 regression] New (since gcc 12) false positive null-dereference in vector.resize + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108860 + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0) + set(PEDANTIC_COMPILE_FLAGS ${PEDANTIC_COMPILE_FLAGS} -Wnull-dereference) + endif () endif () set(WERROR_FLAG -Werror) endif ()