PATCH: Fix 2 PPC/SYSV varargs problems

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Sat Jul 31 22:30:00 GMT 1999


At 03:26 01.07.99 , Richard Henderson wrote:
>On Wed, Jun 30, 1999 at 11:20:24AM +0200, Franz Sirl wrote:
> > Well, the corner case that lead me to that solution was:
>
>Doh.  The correct solution is
>
>  -      if (gpr >= GP_ARG_NUM_REG)
>  +      if (gpr > GP_ARG_NUM_REG)

Well, :-), this condition will never be true.

Score: rth 0 : franzo 1  :-))

Try:
#include <varargs.h>

typedef long long int INT64;

inline void debug(i1, i2, i3, i4, i5, i6, i7, i8, i9, va_alist)
   int i1, i2, i3, i4, i5, i6, i7, i8, i9;
   va_dcl
{
   va_list ap;

   va_start(ap);

   if ( va_arg(ap,int) != 10)
     abort();
   if ( va_arg(ap,INT64) != 0x123400005678LL)
     abort();
   va_end( ap );
}

int main(void)
{
      debug(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0x123400005678LL);
      exit(0);
}

Franz.



More information about the Gcc-patches mailing list