http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776
--- Comment #11 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to dean from comment #10) > this is unfortunate really -- the newer LZCNT/TZCNT instructions on x86 > explicitly return 8*sizeof(type) for input of zero Same as the power cntlz* instructions. And in both cases we implement intrinsics as a call to __builtin_clz*. So it would make sense to assume this behavior in the optimizations (if it is undefined behavior, picking this behavior won't break more things than assuming it never happens).