KeDeng has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/23061


Change subject: Fix unaligned pointer warning on ARM due to 
address-of-packed-member in CBTree
......................................................................

Fix unaligned pointer warning on ARM due to address-of-packed-member in CBTree

On ARM-based platforms (e.g., Rocky Linux 9), building Kudu triggers the
following warning:

  warning: taking address of packed member of ‘InternalNode<DMSTreeTraits>’
  may result in an unaligned pointer value [-Waddress-of-packed-member]

This warning was raised in InternalNode::Insert(), where the address of the
packed member 'num_children_' is passed to base::subtle::Release_Store().
Taking the address of a packed field can lead to unaligned memory access,
which is undefined behavior on some architectures like ARM.

To fix this, avoid directly taking the address of the packed member. Instead,
cast the pointer through an intermediate uintptr_t to ensure alignment
safety, or use memcpy to avoid potential misalignment issues.

This change suppresses the warning and ensures safe access to memory
across architectures without changing the memory layout.

Tested on: Rocky Linux 9 (aarch64)

Change-Id: Ib8e6f7b0d3516409ae99e4c846f839b6868b3deb
---
M src/kudu/tablet/concurrent_btree.h
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/61/23061/1
--
To view, visit http://gerrit.cloudera.org:8080/23061
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8e6f7b0d3516409ae99e4c846f839b6868b3deb
Gerrit-Change-Number: 23061
Gerrit-PatchSet: 1
Gerrit-Owner: KeDeng <[email protected]>

Reply via email to