https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116989
Bug ID: 116989
Summary: __builtin_clz{,g}/__builtin_ctz{,g} documentation for
0 should be clearer
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: documentation
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Right now we have "the result is undefined" which implies that is undefined
behavior if these are passed 0 but some folks interrupt that the resulting
value is undefined which has slightly different semantics.
I think the wording should be, "If x is 0 and is reached, there is undefined
behavior" or something to that effect.
This was mentioned in the stmgcc talk in GCC cauldron 2024 and at
https://hachyderm.io/@[email protected]/112950531847708182 .