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. > If it helps, gcc fixed a similar problem recently, according to Iain Sandoe 2010-07-24 08:08:00 UTC "fixed at least >= 4.4." Perhaps if I can find the commit I will get a clue to expand the search. BTW I adapted this test from the following bug report while trying to figure out why GTK+ was crashing on mouse clicks. This is certainly easier to debug than mouse clicks. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18742 I noticed that "short int profile" can be replaced simply by "int profile" and no change. I did a regression test and found no time when it worked, so I started with 9d347f87426aebabe4eb52207b2f9ea8d2274809 and put a break on void gfunc_call(int nb_args) in x86_64-gen.c:593: and poked around, wondering what type_size() should be returning. I didn't think to look at stdarg.h or regress gcc and see what differences in the gcc implementation fixed it, but I suppose that would be the logical step.
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/tinycc-devel