[libcxx-commits] [clang] [compiler-rt] [libcxx] [clang] Add unistd fortify checks and analyzer size constraints (PR #196499)
Denys Fedoryshchenko via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 28 03:00:36 PDT 2026
================
@@ -21,6 +21,6 @@ static_assert(std::__constexpr_wmemcmp(L"Banane", L"Bananf", 6) == -1, "");
constexpr bool test_constexpr_wmemchr() {
const wchar_t str[] = L"Banane";
- return std::__constexpr_wmemchr(str, 'n', 6) == str + 2;
+ return std::__constexpr_wmemchr(str, L'n', 6) == str + 2;
----------------
nuclearcat wrote:
Before commit `[clang][Sema] Add min/max operation size for fortify checks`, the memcpy/memmove/mempcpy fortify case in SemaChecking.cpp only computed DestinationSize and checked destination overflow.
After this commit, it also sets SourceSize = ComputeSizeArgument(1), and the new warn_fortify_destination_over_read diagnostic fires when SourceSize < MinOperationSize - which exposes the latent type mismatch in this test ('n' deduces _Up = char, so the internal __builtin_memcpy over-reads the 1-byte source).
https://github.com/llvm/llvm-project/pull/196499
More information about the libcxx-commits
mailing list