Skip to content

Commit

Permalink
fixed #12113 - made CMake build work with UBSAN and GCC (danmar#5590)
Browse files Browse the repository at this point in the history
GCC does not support `-fsanitize=nullability`
  • Loading branch information
firewave authored Oct 24, 2023
1 parent 89df134 commit 122e142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmake/dynamic_analyzer_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ endif()

if(ANALYZE_UNDEFINED)
# TODO: enable signed-integer-overflow
add_compile_options(-fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow)
add_compile_options(-fsanitize=undefined -fno-sanitize=signed-integer-overflow)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-fsanitize=nullability)
endif()
add_compile_options(-fno-sanitize-recover=all)
add_compile_options(-fno-omit-frame-pointer)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fsanitize=nullability -fno-sanitize=signed-integer-overflow")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize=signed-integer-overflow")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=nullability")
endif()
endif()

if(ANALYZE_DATAFLOW)
Expand Down
1 change: 1 addition & 0 deletions releasenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ Other:
- You can suppress warnings in a block of code using "-begin" and "-end".
- You can suppress warnings in current file using "-file".
- You can suppress all warnings where macro is used using "-macro"
- fixed CMake build with UBSAN and GCC

0 comments on commit 122e142

Please sign in to comment.