https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81759
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Daniel Fruzynski from comment #2) > Looks that __builtin_ffs does not check if input value is nonzero at all. > Assembler code for following code also has unnecessary instructions: > > [code] > unsigned int test(unsigned int n) > { > if (n == 0) > __builtin_unreachable(); > return __builtin_ffs(n) - 1; > } > [/code] The above is now handled since GCC 11.