On Tue, Nov 19, 2013 at 10:16:31AM +0100, Andreas Schwab wrote: > Alan Modra <amo...@gmail.com> writes: > > > On Tue, Nov 19, 2013 at 11:16:26AM +1030, Alan Modra wrote: > >> On Tue, Nov 19, 2013 at 01:27:39AM +0100, Andreas Schwab wrote: > >> > Where does it call a varargs function? > >> > >> printf > > > > Sorry that wasn't such a helpful response. > > > > Here, really: > > res = ((int(*)(char*, ...))(code))(format, doubleArg); > > But cls_double_va_fn doesn't expect a varargs call.
It works this way: The call shown above sets up arguments as for a call to printf, and transfers control to a trampoline. On powerpc64 the trampoline bounces to ffi_closure_LINUX64. This assembly function saves parameter passing registers to memory and calls some C code, ffi_closure_helper_LINUX64, that uses information set up by ffi_prep_cif_var to extract the arguments and package them up for cls_double_va_fn. So it is ffi_closure_helper_LINUX64 that expects a varargs call, under control of ffi_prep_cif_var. It looks to me like the new libffi test failures on ia64 are due to libffi on ia64 not differentiating between varargs and normal calls, yet ia64 passes passes fp differently for varargs if I'm reading gcc/config/ia64.c function_arg correctly. -- Alan Modra Australia Development Lab, IBM