From aa36639b5a5e9f76b081c6cae4049999de629ff0 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 12 Aug 2024 16:26:25 -0400 Subject: [PATCH] enable c++ standard library debug checks --- cmake/setup_compiler_flags_gnu.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake index 263c57bc85..321dbfd314 100644 --- a/cmake/setup_compiler_flags_gnu.cmake +++ b/cmake/setup_compiler_flags_gnu.cmake @@ -187,6 +187,13 @@ if (CMAKE_BUILD_TYPE MATCHES "Debug") list(APPEND DEAL_II_DEFINITIONS_DEBUG "DEBUG") + # Enable invalid element access and other checks in the c++ standard libray: + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_GLIBCXX_ASSERTIONS") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_ENABLE_ASSERTIONS") + list(APPEND DEAL_II_DEFINITIONS_DEBUG "_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE") + endif() + # # We have to ensure that we emit floating-point instructions in debug # mode that preserve the occurrence of floating-point exceptions and don't -- 2.39.5