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

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Georg-Johann Lay
<g...@gcc.gnu.org>:

https://gcc.gnu.org/g:61789b5abec3079d02ee9eaa7468015ab1f6f701

commit r15-9837-g61789b5abec3079d02ee9eaa7468015ab1f6f701
Author: Georg-Johann Lay <a...@gjlay.de>
Date:   Sat Jun 14 19:57:18 2025 +0200

    AVR: Fix PR120423 / PR116389.

    The problem with PR120423 and PR116389 is that reload might assign an
invalid
    hard register to a paradoxical subreg.  For example with the test case from
    the PR, it assigns (REG:QI 31) to the inner of (subreg:HI (QI) 0) which is
    valid, but the subreg will be turned into (REG:HI 31) which is invalid
    and triggers an ICE in postreload.

    The problem only occurs with the old reload pass.

    The patch maps the paradoxical subregs to a zero-extends which will be
    allocated correctly.  For the 120423 testcases, the code is the same like
    with -mlra (which doesn't implement the fix), so the patch doesn't even
    introduce a performance penalty.

    The patch is only needed for v15:  v14 is not affected, and in v16 reload
    will be removed.

            PR rtl-optimization/120423
            PR rtl-optimization/116389
    gcc/
            * config/avr/avr.md [-mno-lra]: Add pre-reload split to transform
            (left shift of) a paradoxical subreg to a (left shift of)
zero-extend.
    gcc/testsuite/
            * gcc.target/avr/torture/pr120423-1.c: New test.
            * gcc.target/avr/torture/pr120423-2.c: New test.
            * gcc.target/avr/torture/pr120423-116389.c: New test.

Reply via email to