Old gcc method parameter error
Ian Lance Taylor
iant@google.com
Thu Sep 29 21:20:00 GMT 2011
Fabian Cenedese <Cenedese@indel.ch> writes:
> The problem is with the way the parameters are placed on the stack if there's
> not enough space in the registers (r3-r10, f1-f8).
>
> unsigned long MyClass::Func(unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4,
> unsigned long a5, unsigned long a6, unsigned long a7, unsigned long a8, double d, char* s)
> {
> printf("Received string: '%s'.", s);
> return 0;
> }
>
> void MyClass::Func2()
> {
> Func(1, 2, 3, 4, 5, 6, 7, 8, 9.9, "testing");
> }
>
> I'd expect that r3 would hold the 'this' pointer, r4-r10 would hold the first
> seven arguments, f1 would hold the double value and a8 and the string
> pointer would be passed on the stack as two consecutive values
> (e.g. x+8 and x+12, x is some offset in the stack).
My guess would be that gcc 2.95.2 has a bug when some arguments that are
placed in registers follow some arguments that are placed on the stack.
The PPC EABI is unusual in permitting that to happen. That bug could
have been fixed any time in the last 10 years. It would probably be a
change to gcc/function.c or gcc/calls.c.
Ian
More information about the Gcc-help
mailing list