On Tue, Aug 27, 2013 at 11:03:32AM +0200, Richard Biener wrote: > On Wed, Jul 10, 2013 at 3:14 AM, Stefan Kristiansson > <stefan.kristians...@saunalahti.fi> wrote: > > The (static arg) generator functions are casted to a var arg > > function pointer, making the assumption that the ABI for passing > > the arguments will be the same as for static arguments. > > This isn't a valid assumption on all architectures, var args might for > > example be passed on the stack, even if there would be function argument > > registers still available. > > > > There exists a bugreport for the problem here: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12081 > > > > This patch is taken from the suggestion by Rask Ingemann Lambertsen > > and updated to the current svn tip of trunk. > > > > gcc/Changelog: > > > > 2013-07-10 Stefan Kristiansson <stefan.kristians...@saunalahti.fi> > > > > PR target/12081 > > * recog.h (rtx (*insn_gen_fn) (rtx, ...)): Remove typedef. > > (genfun): Replace var arg function pointer with static argument > > function pointers. > > * optabs.h (GEN_FCN): Replace single define with ones of the > > form GEN_FCN?, where ? is the number of arguments. > > * reload1.c: Use GEN_FCN? instead of GEN_FCN > > Can't we use a template for all this to avoid the union and *[12345] mess? >
Oleg Endo proposed a cleaner approach using functors here: http://gcc.gnu.org/ml/gcc-patches/2013-07/msg01315.html and AFAIK that (or something close to it) is already applied. Stefan