From e9271e683536619bbec55d14ac004fdf218b61ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 11 Nov 2014 22:21:27 +0100 Subject: [PATCH] Add a MemSan Cmake build type Detects uninitialised memory reads. Available only with Clang on Linux x86_64 for now. Experimental but seems usable enough. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2e60aa3c..1596226c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,11 +19,13 @@ if(CMAKE_COMPILER_IS_CLANG) set(CMAKE_C_FLAGS_DEBUG "-g3 -O0") set(CMAKE_C_FLAGS_COVERAGE "-g3 -O0 --coverage") set(CMAKE_C_FLAGS_ASAN "-fsanitize=address -fsanitize=undefined -fno-sanitize-recover -fno-omit-frame-pointer -g3 -O1 -Werror") + # note: can add -fsanitize-memory-track-origins=2 for debugging with memsan + set(CMAKE_C_FLAGS_MEMSAN "-fsanitize=memory -fno-omit-frame-pointer -fno-optimize-sibling-calls -g3 -O1 -Werror") set(CMAKE_C_FLAGS_CHECK "-O1 -Werror") endif(CMAKE_COMPILER_IS_CLANG) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} - CACHE STRING "Choose the type of build: None Debug Release Coverage ASan Check CheckFull" + CACHE STRING "Choose the type of build: None Debug Release Coverage ASan MemSan Check CheckFull" FORCE) if(CMAKE_BUILD_TYPE STREQUAL "Coverage")