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

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org

--- Comment #5 from Wilco <wilco at gcc dot gnu.org> ---
It seems a latent bug in arm_r3_live_at_start_p which now triggers much more
often due to stack clash protection:

  if (IS_NESTED (arm_current_func_type ())
      && ((TARGET_APCS_FRAME && frame_pointer_needed && TARGET_ARM)
          || ((flag_stack_check == STATIC_BUILTIN_STACK_CHECK
               || flag_stack_clash_protection)
              && !df_regs_ever_live_p (LR_REGNUM)))
      && arm_r3_live_at_start_p ()
      && crtl->args.pretend_args_size == 0)

Given that liveness can't guarantee dead registers won't look live at start,
the r3_live_at_start should really be about function parameters which is a
fixed concept. Is there no query that can accurately tell you which registers
are used for parameters in the current function?

For GCC9 we need to redesign this whole area - most of the above checks are
quite inaccurate (for example a temporary is only used for stack checking if
the stack size is > 16KB), copy and pasted multiple times in slightly different
ways, and not cached when computing the frame layout like on AArch64.

However a quick workaround for GCC8 would be to assume arm_r3_live_at_start_p
is always true in the above code. Also we should never change the generated
code in functions which do not require stack checking, so changing the stack
checking enabled test to framesize > 16KB would be the right thing to do.

Reply via email to