zanmato1984 commented on code in PR #46124:
URL: https://github.com/apache/arrow/pull/46124#discussion_r2049948899


##########
cpp/src/arrow/compute/row/compare_internal.cc:
##########
@@ -276,7 +276,8 @@ void KeyCompare::CompareVarBinaryColumnToRowHelper(
       int32_t tail_length = length - j * 8;
       uint64_t tail_mask = ~0ULL >> (64 - 8 * tail_length);
       uint64_t key_left = 0;
-      std::memcpy(&key_left, key_left_ptr + j, tail_length);
+      const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(key_left_ptr 
+ j);

Review Comment:
   As explained in 
https://github.com/apache/arrow/pull/46124#issuecomment-2814416656 , it could 
be confusing to people why this casting is ever needed, given that it is 
eventually passed down into `std::memcpy` as a `void *`. We can use a comment.
   ```suggestion
         // NOTE: UBSAN may falsely report "misaligned load" in `std::memcpy` 
on some
         // platforms when using 64-bit pointers. Cast to an 8-bit pointer to 
work around
         // this.
         const uint8_t* src_bytes = reinterpret_cast<const 
uint8_t*>(key_left_ptr + j);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to