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

--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
For the minimal testcase we can do:

Index: ira.c
===================================================================
--- ira.c       (revision 229402)
+++ ira.c       (working copy)
@@ -2273,7 +2273,9 @@ ira_setup_eliminable_regset (void)
        || (cfun->calls_alloca && EXIT_IGNORE_STACK)
        /* We need the frame pointer to catch stack overflow exceptions
          if the stack pointer is moving.  */
-       || (flag_stack_check && STACK_CHECK_MOVING_SP)
+       || (flag_stack_check
+          && STACK_CHECK_MOVING_SP
+          && (!crtl->is_leaf || cfun->calls_alloca))
        || crtl->accesses_prior_frames
        || (SUPPORTS_STACK_ALIGNMENT && crtl->stack_realign_needed)
        /* We need a frame pointer for all Cilk Plus functions that use

i.e. do not reserve the frame pointer if the function is leaf and doesn't call
alloca, but this might not be sufficient for the original testcase.

Reply via email to