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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=65956

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So in

/* Implement TARGET_FUNCTION_ARG_BOUNDARY.  Every parameter gets at
   least PARM_BOUNDARY bits of alignment, but will be given anything up
   to STACK_BOUNDARY bits if the type requires it.  */

static unsigned int
mips_function_arg_boundary (machine_mode mode, const_tree type)
{
  unsigned int alignment;

  alignment = type ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode);
  if (alignment < PARM_BOUNDARY)
    alignment = PARM_BOUNDARY;
  if (alignment > STACK_BOUNDARY)
    alignment = STACK_BOUNDARY;
  return alignment;
}

drop the TYPE_ALIGN use if mode is not BLKmode (and assert it is not VOIDmode?
I wonder what we get for integer constants here).

Similar to arm I'm curious what the ABI documentation says for

typedef int myint __attribute__((align(1)));

int foo (myint, myint);

calling convention vs. any other alignment of the args and whether it is
really intended to make those incompatible.

With C11 aligning a type is no longer a GCC extension(?), for previous
C versions either GCC shouldn't change the ABI or document the ABI
extension.

But I really doubt this is an intended behavior.

I see another use in va-arg processing (and va-args are usually the argument
why port maintainers say they need to look at the types of the actual
passed values - but I think the mode and its alignment is what matters)

  /* If the actual alignment is less than the alignment of the type,
     adjust the type accordingly so that we don't assume strict alignment
     when dereferencing the pointer.  */
  boundary *= BITS_PER_UNIT;
  if (boundary < TYPE_ALIGN (type))
    {
      type = build_variant_type_copy (type);
      TYPE_ALIGN (type) = boundary;
    }

Aggregates are tricky (but again, don't look at alignment of actual passed
values!  Look at most at the type alignment of the prototype arg type!
[or for values not passed by reference simply ignore it and use the alignment
of the main variant]).

Reply via email to