[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: va_list problems with optimize option in gcc



on 3/25/02 4:55 AM, Michael Schmitz at
schmitz@opal.biophys.uni-duesseldorf.de wrote:

>> When compiling the valid code below with -O4, the lines getting the
>> va_arg with a float and char will generate this error. Why is this error
>> happening under GCC on PPC only? I've seen some posts about this problem
> 
> Because on PPC, doing bad things with va_lists means stack corruption, no
> questions asked.
> See va-ppc.h for the gory details.
> 
>> /* and here too. */
>> foo_Int8(input, va_arg(args, Int8));
> 
> Use foo_Int8(input, (int8) va_arg(args, Int32));
> 
> Michael
> 
> 

I understand the corruption with chars (int8) and shorts (int16). However, I
will investigate va-ppc.h further, because it seems that in the case when
you are passing more than 8 floats, the svr4 abi doesn't promote a 32bit
float to a 64bit double and this goes on the arg stack. So I wonder how
va-ppc cops with this. You definitely need to pick a 32bit out of the arg
stack, so I can't pass a type double when all arguments don't fit in
register (and there is 8 byte alignment consideration to make matter worse.)
Like I said, I'll dig into this a little bit more tonight.
Thanks for the feedback.
Cheers,


LdS


-- 
To UNSUBSCRIBE, email to debian-powerpc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: