This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Pass nameless arguments in general registers in 32 bit ABI


>   > 	* pa.c (function_arg): Pass nameless arguments in general registers
>   > 	in 32 bit ABI.
> I don't think this is correct.  Why do you think it is necessary/desirable?

A problem was noted with nest-stdar-1.s with the HP assembler.  

#include <stdarg.h>

main ()
{
  static double f (int x, ...)
    {
      va_list args;
      double a;

      va_start (args, x);
      a = va_arg (args, double);
      va_end (args);
      return a;
    }

  if (f (1, (double)1) != 1.0)
    abort ();
  exit (0);
}

The function f ("f__0") expects double in the general registers.  However,
the call in main puts "(double)1" in fr7 with the current code.  The test
passes with the GNU assembler because there is a .PARAM statement which
tells the linker to generate a stub to copy the argument from the floating
to general registers.  The function f__0 saves all the general registers
to the frame.

HP cc doesn't like nested functions so I can't compare directly.  Pulling
the nested function out, I see that gcc and the HP assembler generate
identical calls.  However, the HP compiler adds ARGS_SAVED to the .CALLINFO
statement and this causes the linker to generate a stub for the call
which we don't get with gcc with the HP assembler.

It would seem that we need to generate a "ARGS_SAVED" for functions with
variable numbers of arguments.  However, it still seems to me that we save
a stub copy if we put nameless outgoing arguments (floats in particular)
in the general registers.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]