PATCH: Fix 2 PPC/SYSV varargs problems
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Wed Jun 30 02:21:00 GMT 1999
At 02:14 30.06.99 , Richard Henderson wrote:
>On Tue, Jun 29, 1999 at 11:47:45PM +0200, Franz Sirl wrote:
> > I'm a little bit unsure if it is safe at all to simply decrement
> > words for the !stdarg_p case. Are there no alignment issues here?
>
>No. A varargs declaration always ends with
>
> (va_alist) int va_alist; ...
>
>so we know exactly one integer word was consumed that shouldn't
>have been.
Ah, I understand.
> > BTW, since you digged deep into the ABI, is there a reason for
> > RS6000_VARARGS_SIZE being 8 bytes bigger than needed?
>
>No I havn't delved into that. I suspect it's because previously
>too many FP registers were being saved.
That was also my impression :-)
> > - if (gpr >= GP_ARG_NUM_REG)
> > + if (current_function_args_info.words_used_for_gp_args_flag)
> > words -= 1;
>
>It doesn't seem like this words_used_for_gp_args_flag nastiness
>should be necessary. I'll try and dive back in this evening.
Well, the corner case that lead me to that solution was:
#include <varargs.h>
void debug(i1, i2, i3, i4, i5, i6, i7, f1, f2, f3, f4, f5, f6, f7, f8, f9,
va_alist)
int i1, i2, i3, i4, i5, i6, i7;
double f1, f2, f3, f4, f5, f6, f7, f8, f9;
va_dcl
{
va_list ap;
va_start(ap);
if ( va_arg(ap,int) != 8)
abort();
if ( va_arg(ap,int) != 9)
abort();
if ( va_arg(ap,int) != 10)
abort();
va_end( ap );
}
int main(void)
{
debug(1, 2, 3, 4, 5, 6, 7, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
9.0, 8, 9, 10);
exit(0);
}
I first tried to check for words>0, but that doesn't work with the above
testcase.
With the patch and the __builtin_trap() replaced by abort() the bootstrap
completed and the testsuite is back to normal.
Franz.
More information about the Gcc-patches
mailing list