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: Uros Bizjak <ubizjak at gmail dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>, Andreas Schwab <schwab at linux-m68k dot org>
- Date: Fri, 26 Jul 2013 08:51:41 +0200
- Subject: Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
Hello!
> 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.
Stefan, can you resubmit an updated patch (with proposed update from [1])?
I would really like to see this patch in the mainline.
BTW: I am not c++ expert, but doesn't c++ offer some sort of
abstraction to get rid of
+ union {
+ rtx (*argc0) (void);
+ rtx (*argc1) (rtx);
+ rtx (*argc2) (rtx, rtx);
+ rtx (*argc3) (rtx, rtx, rtx);
+ rtx (*argc4) (rtx, rtx, rtx, rtx);
+ rtx (*argc5) (rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc6) (rtx, rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc10) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ rtx (*argc11) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
+ } genfun;
[1] http://gcc.gnu.org/ml/gcc-patches/2013-07/msg00448.html
Thanks,
Uros.