From f88e209ea93d8be60601f0b0a27d1ff630032dc9 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 5 Oct 2026 12:36:10 +0200 Subject: [PATCH] Ignore libstdc++'s sign change in the sanitizer job libstdc++ 14's initializes a size_t parameter with -1 (GCC bug 119429), so every std::format call fails ci_test_clang_sanitizer under -fsanitize=integer (test-std-format_cpp20). Exclude only the implicit-integer-sign-change check and only that header via -fsanitize-ignorelist. Signed-off-by: Niels Lohmann --- cmake/ci.cmake | 2 +- cmake/clang_sanitizer_ignorelist.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 cmake/clang_sanitizer_ignorelist.txt diff --git a/cmake/ci.cmake b/cmake/ci.cmake index b9d246bbf..c4bced5ba 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -376,7 +376,7 @@ add_custom_target(ci_test_coverage # Sanitizers. ############################################################################### -set(CLANG_CXX_FLAGS_SANITIZER "-g -O1 -fsanitize=address -fsanitize=undefined -fsanitize=integer -fsanitize=nullability -fno-omit-frame-pointer -fno-sanitize-recover=all -fno-sanitize=unsigned-integer-overflow -fno-sanitize=unsigned-shift-base") +set(CLANG_CXX_FLAGS_SANITIZER "-g -O1 -fsanitize=address -fsanitize=undefined -fsanitize=integer -fsanitize=nullability -fno-omit-frame-pointer -fno-sanitize-recover=all -fno-sanitize=unsigned-integer-overflow -fno-sanitize=unsigned-shift-base -fsanitize-ignorelist=${PROJECT_SOURCE_DIR}/cmake/clang_sanitizer_ignorelist.txt") add_custom_target(ci_test_clang_sanitizer COMMAND CXX=${CLANG_TOOL} CXXFLAGS=${CLANG_CXX_FLAGS_SANITIZER} ${CMAKE_COMMAND} diff --git a/cmake/clang_sanitizer_ignorelist.txt b/cmake/clang_sanitizer_ignorelist.txt new file mode 100644 index 000000000..153b6a76d --- /dev/null +++ b/cmake/clang_sanitizer_ignorelist.txt @@ -0,0 +1,8 @@ +# Sanitizer ignore list for ci_test_clang_sanitizer (-fsanitize-ignorelist). +# +# libstdc++ 14's declares `_Scanner(basic_string_view<_CharT>, size_t __nargs = -1)`, so every std::format +# call converts -1 to size_t, which -fsanitize=integer reports as implicit-integer-sign-change. This is +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119429, not a bug in this library. Only that check and only are +# excluded, so implicit sign changes in the library and the tests are still reported. +[implicit-integer-sign-change] +src:*/include/c++/*/format