[all-commits] [llvm/llvm-project] 029cb8: [libc++] Fix copy_backward for vector<bool> with s...

Peng Liu via All-commits all-commits at lists.llvm.org
Wed Mar 19 08:58:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 029cb8aff1450ed6d69f671a5e5e3e226316b42a
      https://github.com/llvm/llvm-project/commit/029cb8aff1450ed6d69f671a5e5e3e226316b42a
  Author: Peng Liu <winner245 at hotmail.com>
  Date:   2025-03-19 (Wed, 19 Mar 2025)

  Changed paths:
    M libcxx/include/__algorithm/copy_backward.h
    M libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/copy_backward.pass.cpp
    M libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy_backward.pass.cpp

  Log Message:
  -----------
  [libc++] Fix copy_backward for vector<bool> with small storage types (#131560)

This patch fixes an issue in libc++ where `std::copy_backward` and
`ranges::copy_backward` incorrectly copy `std::vector<bool>` with small
storage types (e.g., `uint8_t`, `uint16_t`). The problem arises from
flawed bit mask computations involving integral promotions and sign-bit
extension, leading to unintended zeroing of bits. This patch corrects
the bitwise operations to ensure correct bit-level copying.

Fixes #131718.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list