https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115073
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That is misunderstanding of what C[LT]Z_DEFINED_VALUE_AT_ZERO is. The builtin has always UB on zero. If you want to define it for zero, use x ? __builtin_clz (x) : 32 (and the like) or __builtin_clzg (x, 32) in the source. C[LT]Z_DEFINED_VALUE_AT_ZERO returning 2 then makes sure the compiler can fold those conditionals or builtins into .CLZ internal calls with 2 arguments which makes it well defined for all inputs.