NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/59231: assert.h: missing branch prediction
>Number: 59231
>Category: lib
>Synopsis: assert.h: missing branch prediction
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Mar 29 01:40:00 +0000 2025
>Originator: Taylor R Campbell
>Release: current, 10, 9, ...
>Organization:
The NetBSD Assertion
>Environment:
>Description:
The assert() macro, and its cousin _DIAGASSERT for NetBSD-internal library use, gives no hints to the compiler that the condition being asserted is expected to be true.
As a result, the compiler is left to guess which way to prioritize branches, and will often create suboptimal decisions under the premise that the condition has just as good a chance of being false. For example, the compiler is apt to allocate a stack frame in what is otherwise a leaf routine just because it has a subroutine call to __assert13.
>How-To-Repeat:
code inspection
>Fix:
__predict_true
Home |
Main Index |
Thread Index |
Old Index