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

--- Comment #26 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Andrew Pinski
<pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:77867cd8185b206124dd24ce8229cc0bf144c078

commit r9-9765-g77867cd8185b206124dd24ce8229cc0bf144c078
Author: Andrew Pinski <apin...@marvell.com>
Date:   Sun Oct 10 23:12:11 2021 +0000

    [GCC 10 branch] tree-optimization: [PR102622]: wrong code due to signed one
bit integer and "a?-1:0"

    So here is the GCC 10 branch version which fixes the wrong code.
    The problem is we create a negation of an one bit signed integer type
    which is undefined if the value was -1.
    This is not needed for GCC 11 branch since the case is handled differently
    there and has been fixed there (and the trunk has now been fixed too).
    So for one bit types, there is no reason to create the negation so just
    setting neg to false for them, just works.

    OK? Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/102622

    gcc/ChangeLog:

            * tree-ssa-phiopt.c (conditional_replacement): Set neg
            to false for one bit signed types.

    gcc/testsuite/ChangeLog:

            * gcc.c-torture/execute/bitfld-10.c: New test.

    (cherry picked from commit 4111b36079fed95b787fafeed1deaab2dedaf3db)

Reply via email to