On Thu, Dec 16, 2010 at 9:06 AM, Henry Kroll <he...@comptune.com> wrote: > On Wed, 2010-12-15 at 03:07 +0100, grischka wrote: >> Henry Kroll wrote: >> > x86_64 fails to copy the second struct passed to va_arg. >> > >> > static struct myspace { >> > short int profile; >> > } bob = { 42 }; >> > >> > void badfunc(int eek, ...) { >> > va_list ack; >> > int validate; >> > struct myspace george, bill; >> > va_start(ack, eek); >> > bill = va_arg(ack, struct myspace); >> > george = va_arg(ack, struct myspace); >> > validate = va_arg(ack, int); >> > [...] >> > int main(int argc, char **argv) { >> > badfunc(0, bob, bob, bob.profile); >> > [...] >> >> This line from tcc's include/stdarg.h might give a hint: >> /* XXX: this lacks the support of aggregated types. */ >> \ >> >> I have no idea though how such support would look like. >> >> Btw. on win64 it does not work either. I must have misunderstood >> something about the structures part of the calling conventions. >> >> --- grischka >> >> >> _______________________________________________ >> Tinycc-devel mailing list >> Tinycc-devel@nongnu.org >> http://lists.nongnu.org/mailman/listinfo/tinycc-devel > > This passes some hurried tests I threw at it, but I'm sure it needs more > type checking. I used the attached test program to generate a map of > ap->overflow_arg_area for various sized structures.
This is one of my TODO. I think the easiest way would be adding a builtin function like __builtin_aggregate_types_p and using it in stdarg.h. I hesitated to do this because any other compilers don't have such extensions. A better way would be defining __builtin_va_arg just like GCC. I guess I will have some spare time this year end. I'll try working on this if no one don't fix. _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/tinycc-devel