[Bug 293915] strrchr(3) has bug for amd64 ARCHLEVEL=scalar

[email protected] Thu, 19 Mar 2026 12:34:52 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293915

shadowing <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from shadowing <[email protected]> ---
The bug is rooted in lib/libc/amd64/string/strrchr.S. In the scalar
implementation, the bit-parallel optimization—specifically the bswap logic
combined with unaligned memory masks—fails to correctly calculate the offset
when the target character is the NUL terminator. I have verified that
intercepting the NUL character at the function entry and redirecting it to a
safe scalar scan path effectively eliminates this 8-byte address deviation.

-- 
You are receiving this mail because:
You are the assignee for the bug.