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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <[email protected]>:

https://gcc.gnu.org/g:44f26668c6b35ef7f6d71fdc4c89e667bec9a80f

commit r17-6432-g44f26668c6b35ef7f6d71fdc4c89e667bec9a80f
Author: Uros Bizjak <[email protected]>
Date:   Wed Nov 18 20:19:35 2026 +0100

    i386: Require reload_completed for the AND -65536 split [PR target/128836]

    The define_split that converts "and $-65536, reg" to a strict_low_part
    HImode store of zero can fire before reload.  When operands[0] is a
    (subreg:SI (reg:SF N) 0), gen_lowpart (HImode, operands[0]) cannot be
    folded into a valid subreg of the SFmode pseudo, so it silently copies
    the value to a fresh SImode pseudo and returns the lowpart of that.
    The strict_low_part store then updates a pseudo nobody reads and the
    original register keeps its old value, which is a miscompile.

    Fix this by requiring reload_completed, where operands[0] is a hard
    register and gen_lowpart yields a plain REG that aliases the original.

            PR target/128836

    gcc/ChangeLog:

            * config/i386/i386.md
            (split and with -65536 to strict_low_part movhi):
            Require reload_completed.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr128836.c: New test.

Reply via email to