]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
include/cpp-btree: fix false -Warray-bounds in child accessors 68811/head
authorKefu Chai <k.chai@proxmox.com>
Fri, 8 May 2026 00:55:03 +0000 (08:55 +0800)
committerKefu Chai <k.chai@proxmox.com>
Fri, 8 May 2026 06:39:49 +0000 (14:39 +0800)
commit4dfa47e2e128bec7106efb2ffb62c85430a3377a
tree5a780d9c5c86763845c508d44fead070739a2603
parent8bb89be9023669960809efe7dfbb9a9a5e384f28
include/cpp-btree: fix false -Warray-bounds in child accessors

After inlining, GCC's VRP sees mutable_child() reaching a leaf-root
node whose static type only bounds values[], not children[], and fires
even though the if(!leaf()) guard prevents it at runtime:

  btree.h:522: warning: array subscript [33, 287] is outside array
  bounds of 'struct M[32]' [-Warray-bounds]

Decay children[] to a raw pointer in child()/mutable_child() so GCC
has no array bounds to check.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/include/cpp-btree/btree.h