https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113565
--- Comment #5 from Jan Schultke <janschultke at googlemail dot com> --- You can reproduce this as follows: > static_assert(__builtin_clz(0u) == 32); > > unsigned x = 0; > > int main() { > return __builtin_clz(x); > } For base x86_64, GCC emits: (https://godbolt.org/z/nqzYrTWd1) > main: > bsr eax, DWORD PTR x[rip] > xor eax, 31 > ret > x: > .zero 4 Even though __builtin_clz(0u) == 32 passes, this program returns 63. This is obviously not in the interest of the developer, regardless of what the standard mandates.