[all-commits] [llvm/llvm-project] c5195a: [libc++] Fix {std, ranges}::equal for vector<bool>...
Peng Liu via All-commits
all-commits at lists.llvm.org
Wed Mar 19 08:51:43 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c5195ae2d0c1f3925f48ecb0cf037d3f67d45a85
https://github.com/llvm/llvm-project/commit/c5195ae2d0c1f3925f48ecb0cf037d3f67d45a85
Author: Peng Liu <winner245 at hotmail.com>
Date: 2025-03-19 (Wed, 19 Mar 2025)
Changed paths:
M libcxx/include/__algorithm/equal.h
M libcxx/include/__bit_reference
M libcxx/include/__fwd/bit_reference.h
M libcxx/include/__vector/comparison.h
M libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/equal.pass.cpp
M libcxx/test/std/algorithms/alg.nonmodifying/alg.equal/ranges.equal.pass.cpp
Log Message:
-----------
[libc++] Fix {std, ranges}::equal for vector<bool> with small storage types (#130394)
The current implementation of `{std, ranges}::equal` fails to correctly
compare `vector<bool>`s when the underlying storage type is smaller than
`int` (e.g., `unsigned char`, `unsigned short`, `uint8_t` and
`uint16_t`). See [demo](https://godbolt.org/z/j4s87s6b3)). The problem
arises due to integral promotions on the intermediate bitwise
operations, leading to incorrect final equality comparison results. This
patch fixes the issue by ensuring that `{std, ranges}::equal` operate
properly for both aligned and unaligned bits.
Fixes #126369.
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