Disable alignment sanitizer in undefined behaviour sanitizer
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-04-01 12:33:28 +02:00
parent 673bd58b88
commit 3739b0bb66
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 9 additions and 4 deletions

View File

@ -228,9 +228,14 @@ if (PKMNLIB_TESTS)
# Add a definition for the test library
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)
if (SANITIZER_TESTS AND NOT WINDOWS)
target_compile_options(pkmnLib PRIVATE -fsanitize=address,undefined,leak,integer,nullability -fno-sanitize-recover=all -fno-sanitize=unsigned-integer-overflow)
target_compile_options(pkmnLibTests PRIVATE -fsanitize=address,undefined,leak,integer,nullability -fno-sanitize-recover=all)
target_link_options(pkmnLibTests PRIVATE -fsanitize=address,undefined,leak,integer,nullability -fno-sanitize-recover=all)
# Turn on a set of standard sanitizers
# We don't want to recover from any sanitizer error
# Except unsigned overflows (often used in standard libraries etc)
# Except alignment (Angelscript aligns data wrong when allocating, and I don't have the time to fix Angelscripts allocation.)
SET(SANITIZER_OPTS -fsanitize=address,undefined,leak,integer,nullability -fno-sanitize-recover=all -fno-sanitize=unsigned-integer-overflow -fsanitize-recover=alignment)
target_compile_options(pkmnLib PRIVATE ${SANITIZER_OPTS})
target_compile_options(pkmnLibTests PRIVATE ${SANITIZER_OPTS})
target_link_options(pkmnLibTests PRIVATE ${SANITIZER_OPTS})
endif ()
endif ()

View File

@ -1,6 +1,6 @@
#include "ConstString.hpp"
#include <Arbutils/StringView.hpp>
#include <Arbutils/Ensure.hpp>
#include <Arbutils/StringView.hpp>
static void ConstructConstString(void* self) { new (self) ArbUt::StringView(); }
static void ConstructConstStringFromStd(void* self, const std::string& s) {