kkraus14 commented on a change in pull request #10907:
URL: https://github.com/apache/arrow/pull/10907#discussion_r687075130



##########
File path: cpp/src/arrow/compute/exec/key_hash.cc
##########
@@ -186,11 +186,12 @@ void Hashing::hash_varlen_helper(uint32_t length, const 
uint8_t* key, uint32_t*
 
   int tail = length % 16;
   if (tail) {
-    uint64_t last_stripe[2];
-    const uint64_t* last_stripe_base =
+    uint32_t lanes[4];
+    uint64_t* const last_stripe = reinterpret_cast<uint64_t*>(lanes);

Review comment:
       I tried getting it working with zero initializing `last_stripe` but it 
looks like this hits a compiler bug in GCC when using `-O3` and gets us to some 
undefined behavior which can lead to incorrect results: 
https://godbolt.org/z/4e9rbz8E4
   
   Initializing the storage using `uint32_t` and then using `reinterpret_cast` 
to cast to a `uint64_t*` doesn't seem to hit the bug, but not sure how 
comfortable we should be using this generally.
   
   




-- 
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