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 Mar 28, 2024
1 parent ce3784d commit fe4f9fb
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 fe4f9fb

Please sign in to comment.