[Bug tree-optimization/100790] ICE with -O2: in verify_range, at value-range.cc:385

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 17 10:13:41 GMT 2021


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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:

https://gcc.gnu.org/g:f1555d4013ed3cae2589270436387063d1c2f1a3

commit r12-1562-gf1555d4013ed3cae2589270436387063d1c2f1a3
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu May 13 13:47:41 2021 -0400

    Cleanup clz and ctz code in range_of_builtin_call.

    These are various cleanups to the clz/ctz code.

    First, ranges from range_of_expr are always numeric so we
    should adjust.  Also, the checks for non-zero were assuming the argument
    was unsigned, which in the PR's testcase is clearly not.  I've cleaned
    this up, so that it works either way.

    I've also removed the following annoying idiom:

    -         int newmini = prec - 1 - wi::floor_log2 (r.upper_bound ());
    -         if (newmini == prec)

    This is really a check for r.upper_bound() == 0, as floor_log2(0)
    returns -1.  It's confusing.

    Tested on x86-64 Linux.

    gcc/ChangeLog:

            PR tree-optimization/100790
            * gimple-range.cc (range_of_builtin_call): Cleanup clz and ctz
            code.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr100790.c: New test.


More information about the Gcc-bugs mailing list