From 619ee99c34251bb3cff62a2595e6c5191bef330c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 9 Sep 2021 15:01:27 +0200 Subject: [PATCH] Build: Add -fno-delete-null-pointer-checks This prevents GCC and Clang from deleting null pointer checks for optimization purposes. I think we're strictly better off crashing in those cases instead of the compiler hiding errors from us. --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef91256ede..e107f80d97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) add_compile_options(-fsized-deallocation) + +add_compile_options(-fno-delete-null-pointer-checks) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-Wno-literal-suffix) elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")