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

            Bug ID: 86868
           Summary: cc1: warning: stack probing requires
                    '-maccumulate-outgoing-args' for correctness
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com
  Target Milestone: ---
            Target: i386,x86-64

[hjl@gnu-cfl-1 gcc]$ cat /tmp/x.i
extern void foo (void);

void
bar (void)
{
  foo ();
}
[hjl@gnu-cfl-1 gcc]$ ./xgcc -B./ -mno-accumulate-outgoing-args -S /tmp/x.i
[hjl@gnu-cfl-1 gcc]$ ./xgcc -B./ -mno-accumulate-outgoing-args -S /tmp/x.i
-mstack-arg-probe
cc1: warning: stack probing requires ‘-maccumulate-outgoing-args’ for
correctness
[hjl@gnu-cfl-1 gcc]$ 

But there is

#define ACCUMULATE_OUTGOING_ARGS \
  ((TARGET_ACCUMULATE_OUTGOING_ARGS \
    && optimize_function_for_speed_p (cfun)) \
   || (cfun->machine->func_type != TYPE_NORMAL \
       && crtl->stack_realign_needed) \
   || TARGET_STACK_PROBE \
   || TARGET_64BIT_MS_ABI \
   || (TARGET_MACHO && crtl->profile))

-mno-accumulate-outgoing-args is a best effort option.  GCC generates the
same code when

  /* If stack probes are required, the space used for large function
     arguments on the stack must also be probed, so enable
     -maccumulate-outgoing-args so this happens in the prologue.  */
  if (TARGET_STACK_PROBE_P (opts->x_target_flags)
      && !(opts->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
    {
      if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
        warning (0,
                 main_args_p
                 ? G_("stack probing requires %<-maccumulate-outgoing-args%> "
                      "for correctness")
                 : G_("stack probing requires "
                      "%<target(\"accumulate-outgoing-args\")%> for "
                      "correctness"));
      opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
    }

is removed.

Reply via email to