[Bug target/85005] New: Redesign and cleanup arm.c wrt to flag_stack_clash_protection and flag_stack_check

sudi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 20 18:18:00 GMT 2018


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

            Bug ID: 85005
           Summary: Redesign and cleanup arm.c wrt to
                    flag_stack_clash_protection and flag_stack_check
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sudi at gcc dot gnu.org
  Target Milestone: ---

I am creating this for GCC9 as a follow-up on PR 84826 comment 5 by Wilco.
There are several places where the following code is checked.

  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)

Most of these times there is also slight variations on there checks. The flags
being checked (flag_stack_check == STATIC_BUILTIN_STACK_CHECK ||
flag_stack_clash_protection) are also probably not used correctly. This should
be tightened to only have any effect of the frame size is more than 16KB. In
all other cases these flags do not matter. This piece of code is also not
tested given  the number of very specific checks involved and also the fact
that check_effective_target_supports_stack_clash_protection does not list any
Arm backends.


More information about the Gcc-bugs mailing list