https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101175

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
(In reply to Iru Cai from comment #0)
> Built with '-march=x86-64-v3 -O1', the following code generates a bsr
> instruction, which has undefined behavior when the source operand is zero,
> thus gives wrong result

The documentation for __builtin_clz(x) states "If x is 0, the result is
undefined".

Reply via email to