http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Not all CPUs that have defined behavior for 0 define it to the precision though, and even on i?86 it is undefined even when using lzcnt/tzcnt on older CPUs. Even the libgcc routines provide various return values for 0 depending on target (look for COUNT_LEADING_ZEROS_0). So it is not an option to redefine the builtins, they are undefined behavior for 0 and that can't change. There is __builtin_ffs that provides defined behavior for 0.