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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <l...@gcc.gnu.org>:

https://gcc.gnu.org/g:f5ceca96278b2ffaff838216aa6644fedb603573

commit r15-5412-gf5ceca96278b2ffaff838216aa6644fedb603573
Author: Jeff Law <j...@ventanamicro.com>
Date:   Mon Nov 18 10:55:09 2024 -0700

    [committed][RISC-V][PR target/117595] Fix bogus use of simplify_gen_subreg

    And stage3 begins...

    Zdenek's fuzzer caught this one.  Essentially using simplify_gen_subreg
    directly with an offset of 0 when we just needed a lowpart.

    The offset of 0 works for little endian, but for big endian it's simply
wrong.
    simplify_gen_subreg will return NULL_RTX because the case isn't
representable.
    We then embed that NULL_RTX into an insn that's later scanned during
    mark_jump_label.

    Scanning the port I see a couple more instances of this incorrect idiom.  
One
    is pretty obvious to fix.  The others look a bit goofy and I'll probably
need
    to sync with Patrick on them.

    Anyway tested on riscv64-elf and riscv32-elf with no regressions.  Pushing
to
    the trunk.

            PR target/117595
    gcc/
            * config/riscv/sync.md (atomic_compare_and_swap<mode>): Use
gen_lowpart
            rather than simplify_gen_subreg.
            * config/riscv/riscv.cc (riscv_legitimize_move): Similarly.

    gcc/testsuite/
            * gcc.target/riscv/pr117595.c: New test.

Reply via email to