Skip to content

[libc] fix -Warray-bounds in block_offset #77001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions libc/src/string/memory_utils/op_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ template <size_t Size> struct Memcpy {
static constexpr size_t SIZE = Size;
LIBC_INLINE static void block_offset(Ptr __restrict dst, CPtr __restrict src,
size_t offset) {
#ifdef LLVM_LIBC_HAS_BUILTIN_MEMCPY_INLINE
return __builtin_memcpy_inline(dst + offset, src + offset, SIZE);
#else
// The codegen may be suboptimal.
for (size_t i = 0; i < Size; ++i)
dst[i + offset] = src[i + offset];
#endif
memcpy_inline<Size>(dst + offset, src + offset);
}

LIBC_INLINE static void block(Ptr __restrict dst, CPtr __restrict src) {
Expand Down