[Bug target/114846] powerpc: epilogue in _Unwind_RaiseException corrupts return value due to __builtin_eh_return

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 24 01:49:01 GMT 2024


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

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:549701628b64a7c4ac9bb5f9623e83a8dc1d828c

commit r11-11535-g549701628b64a7c4ac9bb5f9623e83a8dc1d828c
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue May 28 21:13:40 2024 -0500

    rs6000: Don't clobber return value when eh_return called [PR114846]

    As the associated test case in PR114846 shows, currently
    with eh_return involved some register restoring for EH
    RETURN DATA in epilogue can clobber the one which holding
    the return value.  Referring to the existing handlings in
    some other targets, this patch makes eh_return expander
    call one new define_insn_and_split eh_return_internal which
    directly calls rs6000_emit_epilogue with epilogue_type
    EPILOGUE_TYPE_EH_RETURN instead of the previous treating
    normal return with crtl->calls_eh_return specially.

            PR target/114846

    gcc/ChangeLog:

            * config/rs6000/rs6000-logue.c (rs6000_emit_epilogue): As
            EPILOGUE_TYPE_EH_RETURN would be passed as epilogue_type directly
            now, adjust the relevant handlings on it.
            * config/rs6000/rs6000.md (eh_return expander): Append by calling
            gen_eh_return_internal and emit_barrier.
            (eh_return_internal): New define_insn_and_split, call function
            rs6000_emit_epilogue with epilogue type EPILOGUE_TYPE_EH_RETURN.

    gcc/testsuite/ChangeLog:

            * gcc.target/powerpc/pr114846.c: New test.

    (cherry picked from commit e5fc5d42d25c86ae48178db04ce64d340a834614)


More information about the Gcc-bugs mailing list