From 0a7620285b5cb9f02a26deeff8c576dec851e5fa Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:54:15 -0700 Subject: [PATCH] Improve the CMake clang -fsanitize=memory flags (#4267) -fsanitize=memory is almost useless without using -fsanitize-memory-track-origins=2 and we shoud probably add -fno-optimize-sibling-calls as well. --- config/sanitizer/sanitizers.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index bf2aad27d7c..0afb2077910 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -80,11 +80,10 @@ if(USE_SANITIZER) endif() if(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") - # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 set(SANITIZER_MEM_FLAG "-fsanitize=memory") if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") message(STATUS "Testing with MemoryWithOrigins sanitizer") - append("-fsanitize-memory-track-origins" SANITIZER_MEM_FLAG) + append("-fno-optimize-sibling-calls -fsanitize-memory-track-origins=2" SANITIZER_MEM_FLAG) else() message(STATUS "Testing with Memory sanitizer") endif()