On 9/5/2021 3:39 PM, Roger Sayle wrote:
As diagnosed with Jakub and Richard in the analysis of PR 102134, the
current implementation of wi::clz has incorrect/inconsistent behaviour.
As mentioned by Richard in comment #7, clz should (always) return zero
for negative values, but the current implementation can only return 0
when precision is a multiple of HOST_BITS_PER_WIDE_INT.  The fix is
simply to reorder/shuffle the existing tests.

This patch has been tested on x86_64-pc-linux-gnu with "make bootstrap"
and "make -k check" with no new failures.

Ok for mainline?

2021-09-05  Roger Sayle  <ro...@nextmovesoftware.com>

gcc/ChangeLog
        * gcc/wide-int.cc (wi::clz): Reorder tests to ensure the result
        is zero for all negative values.
OK
jeff

Reply via email to