ppc AIX vararg patch

Geoff Keating geoffk@cygnus.com
Wed Jan 19 15:53:00 GMT 2000


> cc: gcc-patches@gcc.gnu.org
> Date: Wed, 19 Jan 2000 17:59:20 -0500
> From: David Edelsohn <dje@watson.ibm.com>
> 
> 	I do not think that this patch is correct or wise.  GCC should
> match the AIX calling convention.  I can send you the dicussions that
> Jeff, Wilson, Kenner, and Joern had about this back in 1997.
...
> 	This is an extremely subtle and delicate part of GCC, so please do
> not apply quick fixes that cover up the problem.

Hmmm.  I should have mentioned _which_ testcase was failing.

The testcase involved was passing a 3-byte structure to a variadic
function.  GCC was correctly passing it in the most-significant bits,
as per the AIX calling convention.  va_arg was expecting it in the
least-significant bits, and naturally this didn't work :-).

So I changed rs6000_va_arg to expect such structures (actually,
structures of type BLKmode) to be passed the way AIX passes them.


However, what I did first was read the AIX architecture documents, and
try to implement them.  Somewhat to my surprise, this fixed the bug
but caused many other failures.  So I also added a comment saying that
we don't honour the AIX calling convention (for the benefit of future
maintainers, who might not know that), and left the old behaviour for
those cases alone.


The previous version I had was only one line different:  In
rs6000_va_arg, instead of

      if (mode != BLKmode)

it had

      if (! AGGREGATE_TYPE_P (type))

and of course if you fixed the rest of GCC, you would do this too.

In the meantime, however, while I think that it's useful if GCC is
able to interoperate with the native compilers, I also think that it's
essential that GCC be able to interoperate with _itself_.

I might add that one of the places we should be using
FUNCTION_ARG_PADDING is in std_expand_builtin_va_arg.  For the reasons
you explain (in the bit I deleted), I am not brave enough to propose
changing that :-).

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Gcc-patches mailing list