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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Eric Botcazou
<ebotca...@gcc.gnu.org>:

https://gcc.gnu.org/g:0ea3dca7946a1bce072ae5f732a873ce6f207bee

commit r14-10850-g0ea3dca7946a1bce072ae5f732a873ce6f207bee
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Tue Oct 29 21:40:34 2024 +0100

    Fix miscompilation of function containing __builtin_unreachable

    This is a wrong-code generation on the SPARC for a function containing
    a call to __builtin_unreachable caused by the delay slot scheduling pass,
    and more specifically the find_end_label function which has these lines:

      /* Otherwise, see if there is a label at the end of the function. If
there
         is, it must be that RETURN insns aren't needed, so that is our return
         label and we don't have to do anything else.  */

    The comment was correct 20 years ago but no longer is nowadays in the
    presence of RTL epilogues and calls to __builtin_unreachable, so the
    patch just removes the associated two lines of code:

      else if (LABEL_P (insn))
        *plabel = as_a <rtx_code_label *> (insn);

    and otherwise contains just adjustments to the commentary.

    gcc/
            PR rtl-optimization/117327
            * reorg.cc (find_end_label): Do not return a dangling label at the
            end of the function and adjust commentary.

    gcc/testsuite/
            * gcc.c-torture/execute/20241029-1.c: New test.

Reply via email to