aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorPeng Liu <winner245@hotmail.com>2025-03-19 11:55:51 -0400
committerGitHub <noreply@github.com>2025-03-19 11:55:51 -0400
commita5b3d3a03f3291b1b62c7c25bc40b494660421cb (patch)
tree77b955c0fec2e7f9cab822566f115e8f832c6706 /clang/lib/CodeGen/ModuleBuilder.cpp
parent480202f0d16f7dbc5c650aea6e8dfd9eca5b999d (diff)
downloadllvm-a5b3d3a03f3291b1b62c7c25bc40b494660421cb.zip
llvm-a5b3d3a03f3291b1b62c7c25bc40b494660421cb.tar.gz
llvm-a5b3d3a03f3291b1b62c7c25bc40b494660421cb.tar.bz2
[libc++] Fix {std, ranges}::copy for vector<bool> with small storage types (#131545)
The current implementation of `{std, ranges}::copy` fails to copy `vector<bool>` correctly when the underlying storage type (`__storage_type`) is smaller than `int`, such as `unsigned char`, `unsigned short`, `uint8_t` and `uint16_t`. The root cause is that the unsigned small storage type undergoes integer promotion to (signed) `int`, which is then left and right shifted, leading to UB (before C++20) and sign-bit extension (since C++20) respectively. As a result, the underlying bit mask evaluations become incorrect, causing erroneous copying behavior. This patch resolves the issue by correcting the internal bitwise operations, ensuring that `{std, ranges}::copy` operates correctly for `vector<bool>` with any custom (unsigned) storage types. Fixes #131692.
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions