george@pyrps5 (George Vasick) (04/12/90)
> I have a large program that uses varargs fairly heavily, which crashes > in very mysterious ways. I have reason to suspect that the crashes > are due to the pyramid implementation of varargs. > > 1.4 varargs.h seems to use routines called _vastart and _vaarg > (defined in /lib/libc.a). Can anyone explain to me what these routines > do? Also why is va_alist limited only to 12 arguments? Arguments are split between the data stack and the control stack on the Pyramid architecture. _vastart initializes va_buf. _vaarg uses and updates va_buf to step through the arguments. va_buf holds a pointer to the next register argument, a pointer to the next stack argument and a counter. The only purpose of va_alist is to busy all 12 parameter register so that the code generator does not use them for something else. > And last, va_buf is defined to be an integer array containing only > _VALEN elements (which is only 3!!). Does this mean that _vastart > and _vaarg will fail for any number greater than this?? No. Past versions of Pyramid's varargs have had limitations with UNION's and STRUCT's 8 bytes in length or less and there was a bug with CHAR and SHORT arguments. These are all fixed in OSx5.1 or later. George