HomeFreeBSD

rb tree: remove strict aliasing violations

Description

rb tree: remove strict aliasing violations

Rework internal RB macros to avoid assignments via type punned pointers.
RB uses low order pointer bits to encode information (whether children
are red), and was manipulating those values via (*(__uintptr_t *)&elm),
which leads to strict aliasing warnings.

In the kernel we use -fno-strict-aliasing, but this isn't necessarily
the case in user space. This quiets thousands of -Wstrict-aliasing
warnings in the user space build.

Reported by: GCC -Wstrict-aliasing
Reviewed by: dougm
Discussed with: kib
Differential Revision: https://reviews.freebsd.org/D52939

Details

Provenance
rlibbyAuthored on Oct 15 2025, 4:05 AM
Reviewer
dougm
Differential Revision
D52939: rb tree: remove strict aliasing violations
Parents
rGb679303544b3: fsck_ffs: garbage collect calcsb
Branches
Unknown
Tags
Unknown