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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:3e60ddeb8220ed388819bb3f14e8caa9309fd3c2

commit r11-5927-g3e60ddeb8220ed388819bb3f14e8caa9309fd3c2
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Dec 11 11:10:17 2020 +0100

    expansion: Sign or zero extend on MEM_REF stores into SUBREG with
SUBREG_PROMOTED_VAR_P [PR98190]

    Some targets decide to promote certain scalar variables to wider mode,
    so their DECL_RTL is a SUBREG with SUBREG_PROMOTED_VAR_P.
    When storing to such vars, store_expr takes care of sign or zero extending,
    but if we store e.g. through MEM_REF into them, no sign or zero extension
    happens and that leads to wrong-code e.g. on the following testcase on
    aarch64-linux.

    The following patch uses store_expr if we overwrite all the bits and it is
    not reversed storage order, i.e. something that store_expr handles
normally,
    and otherwise (if the most significant bit is (or for pdp11 might be, but
    pdp11 doesn't promote) being modified), the code extends manually.

    2020-12-11  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/98190
            * expr.c (expand_assignment): If to_rtx is a promoted SUBREG,
            ensure sign or zero extension either through use of store_expr
            or by extending manually.

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

Reply via email to