Hello Zoltan Chovan, Zoltan Martonka, Ashwani Raina, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/23061

to look at the new patch set (#3).

Change subject: [Compile]Fix unaligned pointer warning in CBTree
......................................................................

[Compile]Fix unaligned pointer warning in CBTree

When building Kudu with GCC on both ARM (e.g., Rocky Linux 9 aarch64)
and x86, the compiler emits the following warning:

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

This occurred in InternalNode::Insert(), where the address of the packed
field `num_children_` was passed to `base::subtle::Release_Store()`.
On platforms such as ARM, taking the address of a packed struct member can
result in undefined behavior or runtime crashes due to unaligned access.

Upon review, we determined that the atomic `Release_Store()` was unnecessary,
as all access to `num_children_` occurs under exclusive lock protection.
Thus, no memory ordering guarantees are required.

To fix the warning safely and portably, we now update the value via a
temporary variable and `memcpy()` to avoid directly taking the address of
the packed field. This approach avoids undefined behavior and removes the
warning without changing struct layout or semantics.

Tested on: Rocky Linux 9 (aarch64)

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


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/61/23061/3
--
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: newpatchset
Gerrit-Change-Id: Ib8e6f7b0d3516409ae99e4c846f839b6868b3deb
Gerrit-Change-Number: 23061
Gerrit-PatchSet: 3
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: Ashwani Raina <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Zoltan Chovan <[email protected]>
Gerrit-Reviewer: Zoltan Martonka <[email protected]>

Reply via email to