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

--- Comment #20 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <cl...@gcc.gnu.org>:

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

commit r15-5319-ga064fed18a02696586cd8c182fd56c571c9438c1
Author: Christophe Lyon <christophe.l...@linaro.org>
Date:   Thu Oct 3 13:37:16 2024 +0000

    testsuite: Fix tail_call and musttail effective targets [PR116080]

    Some of the musttail tests (eg musttail7.c) fail on arm-eabi because
    check_effective_target_musttail pass, but the actual code in the test
    is rejected.

    The reason is that on arm-eabi with the default configuration, the
    compiler targets armv4t for which TARGET_INTERWORK is true, making
    arm_function_ok_for_sibcall reject a tail-call candidate if
    TREE_ASM_WRITTEN (decl) is false.

    For more recent architecture versions, TARGET_INTERWORK is false,
    hence the problem was not seen on all arm configurations.

    musttail7.c is in turn rejected because f2 is recursive, so
    TREE_ASM_WRITTEN is false.

    However, the same code used in check_effective_target_musttail is not
    recursive and the function body for foo has TREE_ASM_WRITTEN == true.

    The simplest fix is to remove the (empty) body for foo () in
    check_effective_target_musttail.  For consistency, do the same with
    check_effective_target_tail_call.

    gcc/testsuite/ChangeLog:
            PR testsuite/116080
            * lib/target-supports.exp (check_effective_target_tail_call):
            Remove foo's body.
            (check_effective_target_musttail): Likewise.

Reply via email to