https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108140
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> --- If you call __builtin_ctzll with argument 0, it is undefined behavior, you can't make any assumptions, regardless what instructions you assume will be used or are actually used. If you write your code as x ? __builtin_ctzll (x) : 64 or similar, GCC if it uses an instruction that guarantees that result for 0 might actually fold it back into just that instruction unconditionally.