This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- From: Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 27 Aug 2013 12:54:13 +0300
- Subject: Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- Authentication-results: sourceware.org; auth=none
- References: <20130710011456 dot GA25947 at chokladfabriken dot org> <CAFiYyc1Gg_0TU=+WCT=JNTg1gria-pOLAVd+zQsntU+LE=9_vQ at mail dot gmail dot com>
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.kristiansson@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.kristiansson@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