[Bug tree-optimization/97555] [11 Regression] wrong code at -Os and above on x86_64-pc-linux-gnu since r11-3685

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Oct 26 18:06:08 GMT 2020


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

--- Comment #5 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:2118438f49f0c193abe3fa3def350a8129045746

commit r11-4390-g2118438f49f0c193abe3fa3def350a8129045746
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Oct 26 17:50:37 2020 +0100

    Handle signed 1-bit ranges in irange::invert.

    The problem here is we are trying to add 1 to a -1 in a signed 1-bit
    field and coming up with UNDEFINED because of the overflow.

    Signed 1-bits are annoying because you can't really add or subtract
    one, because the one is unrepresentable.  For invert() we have a
    special subtract_one() function that handles 1-bit signed fields.

    This patch implements the analogous add_one() function so that invert
    works.

    gcc/ChangeLog:

            PR tree-optimization/97555
            * range-op.cc (range_tests): Test 1-bit signed invert.
            * value-range.cc (subtract_one): Adjust comment.
            (add_one): New.
            (irange::invert): Call add_one.

    gcc/testsuite/ChangeLog:

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


More information about the Gcc-bugs mailing list