Skip to content

Commit

Permalink
Improve the CMake clang -fsanitize=memory flags (HDFGroup#4267)
Browse files Browse the repository at this point in the history
-fsanitize=memory is almost useless without
using -fsanitize-memory-track-origins=2 and we shoud probably add
-fno-optimize-sibling-calls as well.
  • Loading branch information
derobins authored and qkoziol committed Mar 29, 2024
1 parent 0539ba3 commit 0a76202
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions config/sanitizer/sanitizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0a76202

Please sign in to comment.