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

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

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

commit r16-2597-gf4abe216199930adfa110059c3c8e642c585388b
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Jul 29 09:49:55 2025 +0200

    calls: Allow musttail calls to noreturn [PR121159]

    In the PR119483 r15-9003 change we've allowed musttail calls to noreturn
    functions, after all the decision not to normally tail call noreturn
    functions is not because it is not possible to tail call those, but because
    it screws up backtraces.  As the following testcase shows, we've done that
    only for functions not declared [[noreturn]]/_Noreturn but later on
    discovered through IPA as noreturn.  Functions explicitly declared
    [[noreturn]] have (for historical reasons) volatile FUNCTION_TYPE and
    the FUNCTION_DECLs are volatile as well, so in order to support those
    we shouldn't complain on ECF_NORETURN (we've stopped doing so for musttail
    in PR119483) but also shouldn't complain about TYPE_VOLATILE on their
    FUNCTION_TYPE (something that IPA doesn't change, I think it only sets
    TREE_THIS_VOLATILE on the FUNCTION_DECL).  volatile on function type
    really means noreturn as well, it has no other meaning.

    2025-07-29  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/121159
            * calls.cc (can_implement_as_sibling_call_p): Don't reject declared
            noreturn functions in musttail calls.

            * c-c++-common/pr121159.c: New test.
            * gcc.dg/plugin/must-tail-call-2.c (test_5): Don't expect an error.

Reply via email to