From 30417e9e74d89bc987ad3a98c1e0acfd87c42982 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 8 Oct 2026 16:27:15 +0200 Subject: [PATCH] Exclude libstdc++'s string_view comparison from the sign-change check basic_string_view::_S_compare stores the difference of two lengths in a signed difference_type on purpose, which -fsanitize=integer reports for every comparison with a shorter view (test-json_view_cpp17). Signed-off-by: Niels Lohmann --- cmake/clang_sanitizer_ignorelist.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/clang_sanitizer_ignorelist.txt b/cmake/clang_sanitizer_ignorelist.txt index 153b6a76d..ec54ac571 100644 --- a/cmake/clang_sanitizer_ignorelist.txt +++ b/cmake/clang_sanitizer_ignorelist.txt @@ -4,5 +4,11 @@ # 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. +# +# libstdc++'s compares two views of different lengths through `_S_compare(size_type __n1, size_type +# __n2)`, which stores `__n1 - __n2` in a signed difference_type and clamps it to int. Any comparison with a shorter +# view wraps that subtraction on purpose, and -fsanitize=integer reports it as implicit-integer-sign-change. json_view +# compares keys as string views, so the same check is excluded for as well. [implicit-integer-sign-change] src:*/include/c++/*/format +src:*/include/c++/*/string_view