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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We hit

rtx
allocate_dynamic_stack_space (rtx size, unsigned size_align,
                              unsigned required_align, bool cannot_accumulate)
{
...
  /* ??? STACK_POINTER_OFFSET is always defined now.  */
#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET)
  must_align = true;
  extra_align = BITS_PER_UNIT;
#endif
...
  if (must_align)
    {
      /* CEIL_DIV_EXPR needs to worry about the addition overflowing,
         but we know it can't.  So add ourselves and then do
         TRUNC_DIV_EXPR.  */
      target = expand_binop (Pmode, add_optab, target,
                             gen_int_mode (required_align / BITS_PER_UNIT - 1,
                                           Pmode),
                             NULL_RTX, 1, OPTAB_LIB_WIDEN);
      target = expand_divmod (0, TRUNC_DIV_EXPR, Pmode, target,
                              gen_int_mode (required_align / BITS_PER_UNIT,
                                            Pmode),
                              NULL_RTX, 1);
      target = expand_mult (Pmode, target,
                            gen_int_mode (required_align / BITS_PER_UNIT,
                                          Pmode),
                            NULL_RTX, 1);
    }

thus unconditionally trigger the must_align path (even if in this case
alignment is 32 and thus already properly aligned?).  expand_divmod
doesn't handle power-of-two divisions it seems.

Reply via email to